Types and Utilities
Core type aliases and foundational helpers for options, results, and ordering.
Types (mo:core/Types)
Defines core aliases and structural types used across the library.
Top-level aliases:
Iter<T>-{ next : () -> ?T }Order-{ #less; #equal; #greater }Blob,Error,ErrorCode,Hash,Time,Duration,TimerId,Region,Bool,Char,Text,Pattern
Nested modules and types:
Types.Map- mutable B-tree map layoutNode<K,V>,Data<K,V>,Internal<K,V>,Leaf<K,V>,Map<K,V>PureBTreetypes:BMap,Node,Leaf,Internal,SearchResult,InsertResult,DeleteResult,DeleteTopResult,GrowResult,SplitResult,BorrowResult,MergeResult,NodeCursor,IterDirection,IterState,Bound,Buffer,BuildLeaf,BuildInternal,BuildNode,Builder
Types.Pure- pure structural typesList<T>BTreeMaptypes:Map,Node,Leaf,Internal
Types.Stack-Stack<T>record definition
Bool (mo:core/Bool)
Boolean helpers with contracts. See the full API with types and per-function descriptions in Bool.
Order (mo:core/Order)
Utilities for the Types.Order variant. See Order for the full API.
Option (mo:core/Option)
Option helpers and combinators. See Option for the full API.
Result (mo:core/Result)
Result helpers and combinators.
Types:
Result<Ok, Err> = { #ok : Ok; #err : Err }
See Result for the full API.
Callback Contracts
Several Option and Result helpers accept callbacks, such as map,
chain, equal, and compare. In verified code, callbacks need a known
effect summary when they are used through contracts. If a higher-order helper
is rejected as an uncontracted callback, make the callback pure, give the
function-typed parameter a contract, or isolate the call in a trusted wrapper
whose contract states the intended behavior.
Error (mo:core/Error)
Wrappers around error values and codes.
Types:
Error,ErrorCode
See Error for the full API.
Debug (mo:core/Debug)
Debugging helpers. See Debug for the full API.
Summary
Typesdefines core aliases and shared structural layouts.OptionandResultprovide functional combinators with contracts.Bool,Order,Error, andDebugwrap common utilities with verification-friendly specs.