Look up syntax, contracts, layouts, algorithms, and exact behavior.
The standard library is part of the type environment, not an untyped escape hatch. Each builtin has a visible signature and a type factory. When the checker creates the builtins map, the factory constructs the type graph for that builtin. When a builtin is referenced, the checker freshens the graph so each call site receives independent variables.
let main =
let names = Map.set (Map.empty ()) "ada" 1815 in
if Map.has names "ada"
then Map.get names "ada"
else 0
Typed map success. Map.set fixes names as a (string, int) map; Map.has and Map.get must use string keys, and Map.get returns int.
Array.makeArray.lengthArray.getArray.setArray.appendArray.reverseArray.mapArray.filterArray.existsArray.for_all:int→′a→′aarray:′aarray→int:′aarray→int→′a:′aarray→int→′a→unit:′aarray→′aarray→′aarray:′aarray→′aarray:(′a→′b)→′aarray→′barray:(′a→bool)→′aarray→′aarray:(′a→bool)→′aarray→bool:(′a→bool)→′aarray→boolArray API. Array creation, length, reads, writes, append, and reverse preserve a single element type.
Polymorphic collections force the signature table to connect every repeated type variable at the call site. Array.make connects its element argument to the returned array element type. Array.append and List.append require both operands and the result to share one element type. Array.reverse and List.reverse return a collection with the same element type as the input. Array.filter and List.filter require predicates over the existing element type and return the same collection element type. Array.exists, Array.for_all, List.exists, and List.for_all use the same element-to-bool predicate relationship and return bool. List.cons connects the head value and tail list. Set.add connects the old set element type, inserted value, and returned set. Map.set connects map key, provided key, map value, provided value, and returned map. Map.get returns exactly the value type stored by the map and accepts exactly the map key type.
let main =
let names = Map.set (Map.empty ()) "ada" 1815 in
Map.get names 1815
Typed map rejection. The map key type is string, so an int key cannot type check.
List.emptyList.consList.headList.tailList.is_emptyList.lengthList.appendList.reverseList.mapList.filterList.existsList.for_all:unit→′alist:′a→′alist→′alist:′alist→′a:′alist→′alist:′alist→bool:′alist→int:′alist→′alist→′alist:′alist→′alist:(′a→′b)→′alist→′blist:(′a→bool)→′alist→′alist:(′a→bool)→′alist→bool:(′a→bool)→′alist→boolList API. List operations preserve or transform element types according to their function arguments.
Set.emptySet.addSet.hasSet.length:unit→′aset:′aset→′a→′aset:′aset→′a→bool:′aset→intSet API. Set insertion is persistent and idempotent: adding an existing value returns the existing set.
Float.of_intFloat.to_intString.concatString.lengthString.splitto_stringfstsnd:int→float:float→int:string→string→string:string→int:string→string→stringlist:′a→string:(′a,′b)→′a:(′a,′b)→′bScalar and string API. Scalar conversion and string helpers are typed in the same table as collection helpers.
The editor reuses the same signature table for completion details. That prevents the type checker, hover provider, and autocomplete provider from drifting into contradictory definitions of the standard library.
Map.emptyMap.setMap.getMap.has:unit→(′k,′v)map:(′k,′v)map→′k→′v→(′k,′v)map:(′k,′v)map→′k→′v:(′k,′v)map→′k→boolMap API. Map key and value variables remain connected across empty, set, get, and has.
print and println are checked through custom call logic: they accept int, float, or string and return unit.
to_string accepts any value and formats primitives, tuples, records, arrays, lists, sets, maps, and functions for output.
Tuple postfix projection reads any statically known element by zero-based index; fst and snd remain pair-specific helpers that reject non-pairs.
Array.append and List.append require matching element types and preserve operand order.
Array.reverse and List.reverse allocate reversed collections without changing element types.
Array.filter and List.filter require predicates returning bool and preserve the original element type.
Array.exists, Array.for_all, List.exists, and List.for_all require bool predicates and short-circuit when the result is known.
Array.iter and List.iter require callbacks returning unit.
Array.fold_left and List.fold_left keep accumulator type independent from element type.
Polymorphic builtins compile to uniform i32 functions at runtime; the checker preserves their static element, key, value, and callback relationships.