std/core▲toc

Core functions.

This module is implicitly imported and all functions and types are always available. Some types and operations are required to be defined for the compiler to work correctly (i.e. types like exnstd/core/exn: HX or liststd/core/list: V -> V).

module std/core/typesstd/core/types

Core types.

module std/core/hndstd/core/hnd

Internal effect handler primitives.

effect blockingstd/core/blocking: X

The blockingstd/core/blocking: X effect signifies that a function may block.

effect consolestd/core/console: X

The console effect signifies that a function may write to the console.

type delayedstd/core/delayed: (E, V) -> V<e,a>

Delayed (or lazy) values are computed (with effect e) only the first time forcestd/core/force: forall<a,e> (delayed : delayed<e,a>) -> e a is called and cached afterwards.

fun delay( action : () -> e a ) : delayedstd/core/delayed: (E, V) -> V<e,a>
fun force( delayed : delayedstd/core/delayed: (E, V) -> V<e,a> ) : e a

Force a delayed value; the value is computed only on the first call to forcestd/core/force: forall<a,e> (delayed : delayed<e,a>) -> e a and cached afterwards.

type errorstd/core/error: V -> V<a>

An errorstd/core/error: V -> V type represents a first-class exception result.

con Ok(result : a)
fun default( t : errorstd/core/error: V -> V<a>, def : a ) : a

Use default value def in case of an error.

Automatically generated. Tests for the Okstd/core/Ok: forall<a> (result : a) -> error<a> constructor of the errorstd/core/error: V -> V type.

Transform an errorstd/core/error: V -> V type back to an exn effect.

fun try( action : () -> <exnstd/core/exn: HX|e> a ) : e errorstd/core/error: V -> V<a>

Transform an exception effect to an errorstd/core/error: V -> V type.

struct exceptionstd/core/exception: V(message : stringstd/core/types/string: Vinfo : exception-infostd/core/exception-info: V)

The exception data type.

Show the exception message.

type open exception-infostd/core/exception-info: V

Exception information.

con ExnTodo
effect exnstd/core/exn: HX

Exceptions.

Transform an errorstd/core/error: V -> V type back to an exn effect.

effect fsysstd/core/fsys: X

The fsysstd/core/fsys: X effect signifies a function may access the file system.

type global-scopestd/core/global-scope: S

The global-scopestd/core/global-scope: S is a special type constant to denote the global scope.

alias iostd/core/io: E = <exnstd/core/exn: HX,io-noexnstd/core/io-noexn: E>

The iostd/core/io: E effect is used for functions that perform arbitrary I/O operations.

alias io-noexnstd/core/io-noexn: E = <divstd/core/types/div: X,io-totalstd/core/io-total: E>

The io-noexnstd/core/io-noexn: E effect is used for functions that perform arbitrary I/O operations, but raise no exceptions.

alias io-totalstd/core/io-total: E = <ndetstd/core/types/ndet: X,consolestd/core/console: X,netstd/core/net: X,fsysstd/core/fsys: X,uistd/core/ui: X,ststd/core/types/st: H -> E<globalstd/core/types/global: H>>

The io-totalstd/core/io-total: E effect is used for functions that perform arbitrary I/O operations, but are terminating without raising exceptions.

type liststd/core/list: V -> V<a>

The type of lists, which can be either empty (Nilstd/core/Nil: forall<a> list<a>) or an element followed by a list (Consstd/core/Cons: forall<a> (head : a, tail : list<a>) -> list<a>).

con Cons(head : atail : liststd/core/list: V -> V<a>)

A head element followed by the tail of the list.

con Nil

The empty list.

Append two lists.

Get (zero-based) element n of a list. Return a maybestd/core/types/maybe: V -> V type.

Do all elements satisfy a predicate ?

Are there any elements in a list that satisfy a predicate ?

Append two lists.

Concatenate all lists in a list (e.g. flatten the list). (tail-recursive).

Drop the first n elements of a list (or fewer if the list is shorter than n).

Drop all initial elements that satisfy predicate.

Retain only those elements of a list that satisfy the given predicate pred. For example: filterstd/core/filter: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e list<a>([1,2,3],odd?) == [1,3].

Retain only those elements of a list that satisfy the given predicate pred. For example: filterMap([1,2,3],fn(i) { if (i.odd?) then Nothingstd/core/types/Nothing: forall<a> maybe<a> else Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(i*i) }) == [4].

Find the first element satisfying some predicate.

Find the first element satisfying some predicate and return it.

Concatenate the result lists from applying a function to all elements.

Concatenate the Juststd/core/types/Just: forall<a> (value : a) -> maybe<a> result elements from applying a function to all elements.

fun foldl( liststd/core/list: V -> V<a>, b, (b, a) -> e b ) : e b
fun foldl1( xs : liststd/core/list: V -> V<a>, f : (a, a) -> <exnstd/core/exn: HX|e> a ) : <exnstd/core/exn: HX|e> a
fun foldr1( xs : liststd/core/list: V -> V<a>, f : (a, a) -> <exnstd/core/exn: HX|e> a ) : <exnstd/core/exn: HX|e> a
fun foreach( xs : liststd/core/list: V -> V<a>, action : (a) -> e types/() ) : e types/()

Invoke action for each element of a list.

fun foreach-indexed( xs : liststd/core/list: V -> V<a>, action : (intstd/core/types/int: V, a) -> e types/() ) : e types/()

Invoke action for each element of a list, passing also the position of the element.

Invoke action for each element of a list while action return Nothingstd/core/types/Nothing: forall<a> maybe<a>.

Return the head of list if the list is not empty.

fun head( xs : liststd/core/list: V -> V<a>, default : a ) : a

Return the head of list if the list is not empty, or use default otherwise.

Returns the index of the first element where pred holds, or -1 if no such element exists.

Return the list without its last element. Return an empty list for an empty list.

Insert a separator sep between all elements of a list xs .

Is the list empty?

Automatically generated. Tests for the Nilstd/core/Nil: forall<a> list<a> constructor of the liststd/core/list: V -> V type.

Concatenate all strings in a list using a specific separator.

Return the last element of a list (or Nothingstd/core/types/Nothing: forall<a> maybe<a> for the empty list).

fun last( xs : liststd/core/list: V -> V<a>, default : a ) : a

Return the last element of a list (or default for the empty list).

Returns the length of a list.

Returns an integer list of increasing elements from lo to hi (including both lo and hi ). If lo > hi the function returns the empty list.

Returns an integer list of increasing elements from lo to hi with stride stride. If lo > hi the function returns the empty list.

Applies a function f to list of increasing elements from lo to hi (including both lo and hi ). If lo > hi the function returns the empty list.

Returns an integer list of increasing elements from lo to hi with stride stride. If lo > hi the function returns the empty list.

Create a list of characters from lo to hi (inclusive).

Convert a vector to a list.

Lookup the first element satisfying some predicate.

fun map-indexed( xs : liststd/core/list: V -> V<a>, f : (idx : intstd/core/types/int: V, value : a) -> e b ) : e liststd/core/list: V -> V<b>

Apply a function f to each element of the input list in sequence where takes both the index of the current element and the element itself as arguments.

Apply a function f to each element of the input list in sequence where takes both the index of the current element, the element itself, and the tail list as arguments.

fun map-peek( xs : liststd/core/list: V -> V<a>, f : (value : a, rest : liststd/core/list: V -> V<a>) -> e b ) : e liststd/core/list: V -> V<b>

Apply a function f to each element of the input list in sequence where f takes both the current element and the tail list as arguments.

Invoke action on each element of a list while action returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>.

fun map( xs : liststd/core/list: V -> V<a>, f : (a) -> e b ) : e liststd/core/list: V -> V<b>

Apply a function f to each element of the input list in sequence.

Returns the largest element of a list of integers (or default (=0) for the empty list).

Returns the largest element of a list of doubles (or 0 for the empty list).

Convert a list to a maybestd/core/types/maybe: V -> V type, using Nothingstd/core/types/Nothing: forall<a> maybe<a> for an empty list, and otherwise Juststd/core/types/Just: forall<a> (value : a) -> maybe<a> on the head element. Note: this is just head.

Returns the smallest element of a list of integers (or default (=0) for the empty list).

Returns the smallest element of a list of doubles (or 0 for the empty list).

Partition a list in two lists where the first list contains those elements that satisfy the given predicate pred. For example: partitionstd/core/partition: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e (list<a>, list<a>)([1,2,3],odd?) == ([1,3],[2]).

Remove those elements of a list that satisfy the given predicate pred. For example: removestd/core/remove: forall<a> (xs : list<a>, pred : (a) -> bool) -> list<a>([1,2,3],odd?) == [2].

Create a list of n repeated elementes x.

Reverse a list.

Efficiently reverse a list xs and append it to tl: reverse-appendstd/core/reverse-append: forall<a> (xs : list<a>, tl : list<a>) -> list<a>(xs,tl) == reserve(xs) ++ tl.

Concatenate all strings in a list in reverse order.

Convert a list to a string.

fun single( x : a ) : liststd/core/list: V -> V<a>

Returns a singleton list.

Split a string into parts that were delimited by sep. The delimeters are not included in the results. For example: split("1,,2",",") == ["1","",.

Split a string into at most n parts that were delimited by a string sep. The delimeters are not included in the results (except for possibly the final part). For example: split("1,2,3",",",2) == ["1","2,3"].

Return the sum of a list of integers.

Return the tail of list. Returns the empty list if xs is empty.

Take the first n elements of a list (or fewer if the list is shorter than n).

Keep only those initial elements that satisfy predicate.

Unzip a list of pairs into two lists.

Convert a list to a vector.

Convert a vector to a list with an optional tail.

Zip two lists together by pairing the corresponding elements. The returned list is only as long as the smallest input list.

fun zipwith( xs : liststd/core/list: V -> V<a>, ys : liststd/core/list: V -> V<b>, f : (a, b) -> e c ) : e liststd/core/list: V -> V<c>

Zip two lists together by apply a function f to all corresponding elements. The returned list is only as long as the smallest input list.

Zip two lists together by apply a function f to all corresponding elements and their index in the list. The returned list is only as long as the smallest input list.

effect netstd/core/net: X

The netstd/core/net: X effect signifies a function may access the network.

effect nmdstd/core/nmd: X

The named effect is the default umbrella effect for named effects.

type nullstd/core/null: V -> V<a>

Abstract type used for passing null values to external functions.

Cast a integer that is zero to a null.

alias purestd/core/pure: E = <exnstd/core/exn: HX,divstd/core/types/div: X>

An alias for pure effects: a pure function always returns the same result when called with the same arguments but may not terminate or raise an exception.

effect scopestd/core/scope: S -> X<s>
type sslicestd/core/sslice: V

A sslicestd/core/sslice: V represents a sub-slice of string and has a specific start position and character count. It is used instead of string indices to make the actual internal representation of strings abstract (like UTF-8 or UTF-16). String slices are returned by functions that find sub strings or patterns in in strings. Use stringstd/core/string: (slice : sslice) -> string to create a fresh substring from a slice.

O(count). Advance the start position of a string slice by count characters up to the end of the string. A negative count advances the start position backwards upto the first position in a string. Maintains the character count of the original slice upto the end of the string. For example:
"abc".firststd/core/first: (s : string, n : ?int) -> sslice.advancestd/core/advance: (slice : sslice, count : int) -> sslice(1).string == "b", "abc".firststd/core/first: (s : string, n : ?int) -> sslice.advancestd/core/advance: (slice : sslice, count : int) -> sslice(3).string == "", * "abc".last.advancestd/core/advance: (slice : sslice, count : int) -> sslice(-1).string == "b".

O(1). Return the string slice from the end of slicestd/core/slice: (s : string) -> sslice argument to the end of the string.

O(1). Return the string slice from the start of a string up to the start of slicestd/core/slice: (s : string) -> sslice argument.

Return the common prefix of two strings (upto upto characters (default is minimum length of the two strings)).

O(n). Return the number of characters in a string slice.

An empty slice.

O(count). Extend a string slice by count characters up to the end of the string. A negative count shrinks the slice up to the empty slice. For example:
"abc".firststd/core/first: (s : string, n : ?int) -> sslice.extendstd/core/extend: (slice : sslice, count : int) -> sslice(1).string == "ab" "abc".last.extendstd/core/extend: (slice : sslice, count : int) -> sslice(-1).string == "".

O(n). The first n (default = 1) characters in a string.

Apply a function for each character in a string slice. If action returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>, the function returns immediately with that result.

fun foreach( slice : sslicestd/core/sslice: V, action : (c : charstd/core/types/char: V) -> e types/() ) : e types/()

Apply a function for each character in a string slice.

An invalid slice.

Is a slice empty?

Is a slice not empty?

Is a slice invalid?

O(n). The last n (default = 1) characters in a string.

O(1). The entire string as a slice.

O(n). Copy the slicestd/core/slice: (s : string) -> sslice argument into a fresh string. Takes O(1) time if the slice covers the entire string.

cotype streamstd/core/stream: V -> V<a>

A streamstd/core/stream: V -> V is a co-inductive type representing an infinite list of elements.

con Next(head : atail : streamstd/core/stream: V -> V<a>)

Automatically generated. Retrieves the tail constructor field of the streamstd/core/stream: V -> V type.

alias totalstd/core/total: E = std/core/types/(<>)

An alias for the empty effect.

effect uistd/core/ui: X

The uistd/core/ui: X effect signifies a function may access the graphics system.

alias valuestd/core/value: V -> V<a> = a

TODO: revisit value codegen.

fun (!=)( charstd/core/types/char: V, charstd/core/types/char: V ) : boolstd/core/types/bool: V
fun (!=)( ^x : intstd/core/types/int: V, ^y : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Are two integers not equal?

fun (!=)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : boolstd/core/types/bool: V
fun (!=)( stringstd/core/types/string: V, stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Are two strings not equal?

fun (!=)( x : orderstd/core/types/order: V, y : orderstd/core/types/order: V ) : boolstd/core/types/bool: V
fun (!=)( x : boolstd/core/types/bool: V, y : boolstd/core/types/bool: V ) : boolstd/core/types/bool: V
fun (%)( intstd/core/types/int: V, intstd/core/types/int: V ) : intstd/core/types/int: V

Euclidean modulus of two integers; always a non-negative number. See also divmodstd/core/divmod: (x : int, y : int) -> (int, int).

fun (%)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : doublestd/core/types/double: V
fun (*)( intstd/core/types/int: V, intstd/core/types/int: V ) : intstd/core/types/int: V

Multiply two integers.

fun (*)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : doublestd/core/types/double: V
fun (+)( intstd/core/types/int: V, intstd/core/types/int: V ) : intstd/core/types/int: V

Add two integers.

fun (++)( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Append two strings.

fun (+)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : doublestd/core/types/double: V
fun (+)( c : charstd/core/types/char: V, d : charstd/core/types/char: V ) : totalstd/core/total: E charstd/core/types/char: V

Add two character code points.

fun (-)( intstd/core/types/int: V, intstd/core/types/int: V ) : intstd/core/types/int: V

Substract two integers.

fun (-)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : doublestd/core/types/double: V
fun (-)( c : charstd/core/types/char: V, d : charstd/core/types/char: V ) : totalstd/core/total: E charstd/core/types/char: V

Substract two character codePoints.

fun (/)( x : intstd/core/types/int: V, y : intstd/core/types/int: V ) : intstd/core/types/int: V

Euclidean-0 division of two integers. See also divmodstd/core/divmod: (x : int, y : int) -> (int, int).

fun (/)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : doublestd/core/types/double: V
fun (<)( charstd/core/types/char: V, charstd/core/types/char: V ) : boolstd/core/types/bool: V
fun (<)( ^x : intstd/core/types/int: V, ^y : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is the first integer smaller than the second?

fun (<)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : boolstd/core/types/bool: V
fun (<)( x : orderstd/core/types/order: V, y : orderstd/core/types/order: V ) : boolstd/core/types/bool: V
fun (<)( x : boolstd/core/types/bool: V, y : boolstd/core/types/bool: V ) : boolstd/core/types/bool: V
fun (<)( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : boolstd/core/types/bool: V
fun (<=)( charstd/core/types/char: V, charstd/core/types/char: V ) : boolstd/core/types/bool: V
fun (<=)( ^x : intstd/core/types/int: V, ^y : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is the first integer smaller or equal to the second?

fun (<=)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : boolstd/core/types/bool: V
fun (<=)( x : orderstd/core/types/order: V, y : orderstd/core/types/order: V ) : boolstd/core/types/bool: V
fun (<=)( x : boolstd/core/types/bool: V, y : boolstd/core/types/bool: V ) : boolstd/core/types/bool: V
fun (<=)( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : boolstd/core/types/bool: V
fun (==)( charstd/core/types/char: V, charstd/core/types/char: V ) : boolstd/core/types/bool: V
fun (==)( ^x : intstd/core/types/int: V, ^y : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Are two integers equal?

fun (==)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : boolstd/core/types/bool: V
fun (==)( stringstd/core/types/string: V, stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Are two strings equal? Uses exact equality between character codes.

fun (==)( x : orderstd/core/types/order: V, y : orderstd/core/types/order: V ) : boolstd/core/types/bool: V
fun (==)( x : boolstd/core/types/bool: V, y : boolstd/core/types/bool: V ) : boolstd/core/types/bool: V
fun (>)( charstd/core/types/char: V, charstd/core/types/char: V ) : boolstd/core/types/bool: V
fun (>)( ^x : intstd/core/types/int: V, ^y : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is the first integer greater than the second?

fun (>)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : boolstd/core/types/bool: V
fun (>)( x : orderstd/core/types/order: V, y : orderstd/core/types/order: V ) : boolstd/core/types/bool: V
fun (>)( x : boolstd/core/types/bool: V, y : boolstd/core/types/bool: V ) : boolstd/core/types/bool: V
fun (>)( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : boolstd/core/types/bool: V
fun (>=)( charstd/core/types/char: V, charstd/core/types/char: V ) : boolstd/core/types/bool: V
fun (>=)( ^x : intstd/core/types/int: V, ^y : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is the first integer greater or equal to the second?

fun (>=)( doublestd/core/types/double: V, doublestd/core/types/double: V ) : boolstd/core/types/bool: V
fun (>=)( x : orderstd/core/types/order: V, y : orderstd/core/types/order: V ) : boolstd/core/types/bool: V
fun (>=)( x : boolstd/core/types/bool: V, y : boolstd/core/types/bool: V ) : boolstd/core/types/bool: V
fun (>=)( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : boolstd/core/types/bool: V
fun ([])( ^v : vectorstd/core/types/vector: V -> V<a>, ^index : intstd/core/types/int: V ) : exnstd/core/exn: HX a

Return the element at position index in vector v . Raise an out of bounds exception if index < 0 or index >= v.length .

fun ([])( ^self : local-varstd/core/types/local-var: (H, V) -> V<h,vectorstd/core/types/vector: V -> V<a>>, ^index : intstd/core/types/int: V, assigned : a ) : <localstd/core/types/local: H -> X<h>,exnstd/core/exn: HX|e> types/()

Assign to an entry in a local vectorstd/core/types/vector: V -> V variable.

fun (^)( d : doublestd/core/types/double: V, p : doublestd/core/types/double: V ) : doublestd/core/types/double: V

Returns the value d raised to the power p .

fun (^)( i : intstd/core/types/int: V, exp : intstd/core/types/int: V ) : intstd/core/types/int: V

Raise an integer i to the power of exp.

fun (||)( m1 : maybestd/core/types/maybe: V -> V<a>, m2 : maybestd/core/types/maybe: V -> V<a> ) : maybestd/core/types/maybe: V -> V<a>
fun (||)( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Choose a non-empty string.

fun (~)( i : intstd/core/types/int: V ) : intstd/core/types/int: V

Negate an integer.

fun (~)( d : doublestd/core/types/double: V ) : doublestd/core/types/double: V

Negate a doublestd/core/types/double: V.

fun abs( i : intstd/core/types/int: V ) : intstd/core/types/int: V

Return the absolute value of an integer.

fun abs( d : doublestd/core/types/double: V ) : doublestd/core/types/double: V

Return the absolute value of a doublestd/core/types/double: V d.

fun apply( f : (a) -> e b, x : a ) : e b

Apply a function f to a specified argument x.

fun assert( message : stringstd/core/types/string: V, condition : boolstd/core/types/bool: V ) : types/()
fun at( ^v : vectorstd/core/types/vector: V -> V<a>, ^index : intstd/core/types/int: V ) : maybestd/core/types/maybe: V -> V<a>

Return the element at position index in vector v, or Nothingstd/core/types/Nothing: forall<a> maybe<a> if out of bounds.

fun bool( i : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Convert an int to a boolean, using Falsestd/core/types/False: bool for 0 and Truestd/core/types/True: bool otherwise.

fun bool( m : maybestd/core/types/maybe: V -> V<a> ) : boolstd/core/types/bool: V

Convert a maybestd/core/types/maybe: V -> V type to a boolean using Falsestd/core/types/False: bool for Nothingstd/core/types/Nothing: forall<a> maybe<a> and Truestd/core/types/True: bool for Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>.

fun bool( s : stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Convert a string to a boolean, using Falsestd/core/types/False: bool for the empty string and Truestd/core/types/True: bool otherwise.

fun byte( i : intstd/core/types/int: V ) : bytestd/core/types/byte: V

clamp an intstd/core/types/int: V to fit in a bytestd/core/types/byte: V.

fun capitalize( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Convert the first character of a string to uppercase.

fun catch( action : () -> <exnstd/core/exn: HX|e> a, hndl : (exceptionstd/core/exception: V) -> e a ) : e a

Deprecated; use try instead. Catch an exception raised by throw and handle it. Use on-exn or on-exitstd/core/on-exit: forall<a,e> (hndler : () -> e (), action : () -> e a) -> e a when appropiate.

fun cdiv-exp10( i : intstd/core/types/int: V, n : intstd/core/types/int: V ) : intstd/core/types/int: V
fun cdivmod-exp10( i : intstd/core/types/int: V, n : intstd/core/types/int: V ) : (intstd/core/types/int: V, intstd/core/types/int: V)
fun char( ^i : intstd/core/types/int: V ) : charstd/core/types/char: V

Convert a unicode code point to a character.

fun compare( ^x : intstd/core/types/int: V, ^y : intstd/core/types/int: V ) : orderstd/core/types/order: V

Compare two integers.

fun compare( x : charstd/core/types/char: V, y : charstd/core/types/char: V ) : orderstd/core/types/order: V
fun compare( x : boolstd/core/types/bool: V, y : boolstd/core/types/bool: V ) : orderstd/core/types/order: V
fun compare( x : doublestd/core/types/double: V, y : doublestd/core/types/double: V ) : orderstd/core/types/order: V
fun compare( x : stringstd/core/types/string: V, y : stringstd/core/types/string: V ) : orderstd/core/types/order: V

Compare two strings. Uses the character codes directly for comparison.

fun const( x : a, y : b ) : a

The const funs returns its first argument and ignores the second.

fun const( default : a ) : totalstd/core/total: E ((x : b) -> a)

Return a ‘constant’ function that ignores its argument and always returns the same result.

fun contains( s : stringstd/core/types/string: V, sub : stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Does string s contain the string sub ?

fun count( s : stringstd/core/types/string: V, pattern : stringstd/core/types/string: V ) : intstd/core/types/int: V

Count occurences of pattern in a string.

fun count-digits( i : intstd/core/types/int: V ) : intstd/core/types/int: V

Return the number of decimal digits of i. Return 0 when i==0.

fun count( s : stringstd/core/types/string: V ) : intstd/core/types/int: V

O(n). Return the number of characters in a string.

fun count( s : stringstd/core/types/string: V, pred : (charstd/core/types/char: V) -> boolstd/core/types/bool: V ) : intstd/core/types/int: V

Count the number of times a predicate is true for each character in a string.

fun dec( i : intstd/core/types/int: V ) : intstd/core/types/int: V
fun default( m : maybestd/core/types/maybe: V -> V<a>, nothing : a ) : a

Convert a maybestd/core/types/maybe: V -> V<a> value to a, using the nothing parameter for Nothingstd/core/types/Nothing: forall<a> maybe<a>.

fun divmod( x : intstd/core/types/int: V, y : intstd/core/types/int: V ) : (intstd/core/types/int: V, intstd/core/types/int: V)

Euclidean-0 division & modulus. Euclidean division is defined as: For any D and d where d!=0 , we have:
1. D == d*(D/d) + (D%d) 2. D%d is always positive where 0 <= D%d < abs(d)
Moreover, Euclidean-0 is a total function, for the case where d==0 we have that D%0 == D and D/0 == 0 . So property (1) still holds, but not property (2).
Useful laws that hold for Euclidean-0 division:
D/(-d) == -(D/d) D%(-d) == D%d D/(2^n) == sar(D,n) (with 0 <= n <= 31 and 2^n means 2 to the power of n ) D%(2n) == D & ((2n) - 1) (with 0 <= n <= 31 and 2^n means 2 to the power of n )
See also Division and modulus for computer scientists, Daan Leijen, 2001 for further information available at: http://​research.​microsoft.​com/​pubs/​151917/​divmodnote.​pdf .

fun divmod-exp10( i : intstd/core/types/int: V, n : intstd/core/types/int: V ) : (intstd/core/types/int: V, intstd/core/types/int: V)
fun double( ^i : intstd/core/types/int: V ) : doublestd/core/types/double: V

Convert an integer to a doublestd/core/types/double: V. May return nan if the integer is too large to represent as a doublestd/core/types/double: V.

fun ends-with( s : stringstd/core/types/string: V, post : stringstd/core/types/string: V ) : maybestd/core/types/maybe: V -> V<sslicestd/core/sslice: V>

Does string s end with post? If so, returns a slice of s from the start up to the post string at the end.

fun error-pattern( location : stringstd/core/types/string: V, definition : stringstd/core/types/string: V ) : exnstd/core/exn: HX a

Raise a pattern match exception. This is function is used internally by the compiler to generate error messages on pattern match failures.

fun exp10( exp : intstd/core/types/int: V ) : intstd/core/types/int: V

Calculate 10^exp.

fun exp2( exp : intstd/core/types/int: V ) : intstd/core/types/int: V

Calculate 2^exp.

fun find-last( s : stringstd/core/types/string: V, sub : stringstd/core/types/string: V ) : maybestd/core/types/maybe: V -> V<sslicestd/core/sslice: V>

Return the last index of substring sub in s if it occurs.

fun find( s : stringstd/core/types/string: V, sub : stringstd/core/types/string: V ) : maybestd/core/types/maybe: V -> V<sslicestd/core/sslice: V>

O(n). If it occurs, return the position of substring sub in s, tupled with the position just following the substring sub.

fun fold-int( start : intstd/core/types/int: V, end : intstd/core/types/int: V, init : a, f : (intstd/core/types/int: V, a) -> e a ) : e a

fold over the integers between [startstd/core/start: (sslice : sslice) -> ssize_t,end] (inclusive).

fun fold-int( upto : intstd/core/types/int: V, init : a, f : (intstd/core/types/int: V, a) -> e a ) : e a

fold over the integers between [0,upto) (not including upto).

fun for( ^start : intstd/core/types/int: V, end : intstd/core/types/int: V, action : (intstd/core/types/int: V) -> e types/() ) : e types/()

Executes action for each integer between startstd/core/start: (sslice : sslice) -> ssize_t upto end (including both startstd/core/start: (sslice : sslice) -> ssize_t and end ). If startstd/core/start: (sslice : sslice) -> ssize_t > end the function returns without any call to action .

fun for-while( start : intstd/core/types/int: V, end : intstd/core/types/int: V, action : (intstd/core/types/int: V) -> e maybestd/core/types/maybe: V -> V<a> ) : e maybestd/core/types/maybe: V -> V<a>

Executes action for each integer between startstd/core/start: (sslice : sslice) -> ssize_t upto end (including both startstd/core/start: (sslice : sslice) -> ssize_t and end ). If startstd/core/start: (sslice : sslice) -> ssize_t > end the function returns without any call to action . If action returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>, the iteration is stopped and the result returned.

fun foreach-indexed( v : vectorstd/core/types/vector: V -> V<a>, f : (a, intstd/core/types/int: V) -> e types/() ) : e types/()

Invoke a function f for each element in a vector v.

fun foreach-while( s : stringstd/core/types/string: V, action : (c : charstd/core/types/char: V) -> e maybestd/core/types/maybe: V -> V<a> ) : e maybestd/core/types/maybe: V -> V<a>

Invoke a function for each character in a string. If action returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>, the function returns immediately with that result.

fun foreach-while( v : vectorstd/core/types/vector: V -> V<a>, f : (a) -> e maybestd/core/types/maybe: V -> V<b> ) : e maybestd/core/types/maybe: V -> V<b>

Invoke a function f for each element in a vector v. If f returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>, the iteration is stopped early and the result is returned.

fun foreach( s : stringstd/core/types/string: V, action : (c : charstd/core/types/char: V) -> e types/() ) : e types/()

Invoke a function for each character in a string.

fun foreach( v : vectorstd/core/types/vector: V -> V<a>, f : (a) -> e types/() ) : e types/()

Invoke a function f for each element in a vector v.

fun head-char( s : stringstd/core/types/string: V ) : maybestd/core/types/maybe: V -> V<charstd/core/types/char: V>

Return the first character of a string (or Nothingstd/core/types/Nothing: forall<a> maybe<a> for the empty string).

fun head( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Return the first character of a string as a string (or the empty string).

fun host(): ndetstd/core/types/ndet: X stringstd/core/types/string: V

Return the host environment: dotnet, browser, webworker, node, or libc.

fun ignore( x : a ) : types/()

The ignorestd/core/ignore: forall<a> (x : a) -> () function ignores its argument.

fun inc( i : intstd/core/types/int: V ) : intstd/core/types/int: V
fun inject-local( action : () -> e a ) : totalstd/core/total: E (() -> <localstd/core/types/local: H -> X<h>|e> a)
fun inject-st( () -> e a ) : totalstd/core/total: E (() -> <ststd/core/types/st: H -> E<h>|e> a)

Add the state effect to a function effect.

fun int( charstd/core/types/char: V ) : intstd/core/types/int: V

Convert a character to its unicode code point.

fun int( i : int32std/core/types/int32: V ) : intstd/core/types/int: V

Convert an int32std/core/types/int32: V to an intstd/core/types/int: V.

fun int( i : ssize_tstd/core/types/ssize_t: V ) : intstd/core/types/int: V

Convert an ssize_tstd/core/types/ssize_t: V to an intstd/core/types/int: V.

fun int( i : int64std/core/types/int64: V ) : intstd/core/types/int: V

Convert an int64_t to an intstd/core/types/int: V.

fun int( i : intptr_tstd/core/types/intptr_t: V ) : intstd/core/types/int: V

Convert an intptr_tstd/core/types/intptr_t: V to an intstd/core/types/int: V.

fun int( i : bytestd/core/types/byte: V ) : intstd/core/types/int: V

Convert an bytestd/core/types/byte: V to an intstd/core/types/int: V.

fun int( d : doublestd/core/types/double: V ) : intstd/core/types/int: V

convert a doublestd/core/types/double: V to an intstd/core/types/int: V using round to round to its nearest integer. (rounding to an even number on a tie) Returns 0 if the argument is not finite?.

fun int( b : boolstd/core/types/bool: V ) : intstd/core/types/int: V
fun int( x : orderstd/core/types/order: V ) : intstd/core/types/int: V
fun int32( i : intstd/core/types/int: V ) : int32std/core/types/int32: V

Convert an integer to an int32std/core/types/int32: V. The number is clamped to the maximal or minimum int32std/core/types/int32: V value if it is outside the range of an int32std/core/types/int32: V.

fun int64( i : intstd/core/types/int: V ) : int64std/core/types/int64: V

clamp an intstd/core/types/int: V to fit in an int64_t.

fun intptr_t( i : intstd/core/types/int: V ) : intptr_tstd/core/types/intptr_t: V

clamp an intstd/core/types/int: V to fit in an intptr_tstd/core/types/intptr_t: V.

fun is-alpha( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is the character an ASCII letter is-.

fun is-alpha-num( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is the character ASCII letter or digit?

fun is-ascii( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is the character an ASCII character, e.g. c <= '\DEL' ?

fun is-control( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is the character an ASCII control character, e.g. c < ' ' ?

fun is-digit( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is the character an ASCII digit ?

fun is-empty( s : stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Is a string empty?

fun is-even( i : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is this an even integer?

fun is-exp10( i : intstd/core/types/int: V ) : intstd/core/types/int: V

Return the number of ending 0 digits of i. Return 0 when i==0.

fun is-hex-digit( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is the character an ASCII hexa-decimal digit ?

fun is-lower( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is the character a lower-case ASCII character ?

fun is-neg( i : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is the integer negative (stricly smaller than zero).

fun is-neg( d : doublestd/core/types/double: V ) : boolstd/core/types/bool: V

Is the value negative?

fun is-notempty( s : stringstd/core/types/string: V ) : boolstd/core/types/bool: V

Is a string not empty?

fun is-odd( intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is this an odd integer?

fun is-pos( i : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is the integer positive (stricly greater than zero).

fun is-pos( d : doublestd/core/types/double: V ) : boolstd/core/types/bool: V

Is the value positive?

fun is-upper( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Is the character an upper-case ASCII character ?

fun is-white( c : charstd/core/types/char: V ) : boolstd/core/types/bool: V

Tests if a character is an element of " \t\n\r".

fun is-zero( ^x : intstd/core/types/int: V ) : boolstd/core/types/bool: V

Is this equal to zero?

fun is-zero( d : doublestd/core/types/double: V ) : boolstd/core/types/bool: V

Is the value zero?

fun join( v : vectorstd/core/types/vector: V -> V<stringstd/core/types/string: V> ) : stringstd/core/types/string: V

Concatenate a vector of strings.

fun join( v : vectorstd/core/types/vector: V -> V<stringstd/core/types/string: V>, sep : stringstd/core/types/string: V ) : totalstd/core/total: E stringstd/core/types/string: V

Concatenate a vector of strings with a separator sep.

fun length( ^v : vectorstd/core/types/vector: V -> V<a> ) : intstd/core/types/int: V

Return the length of a vector.

fun main-console( main : () -> e a ) : e a

Used by the compiler to wrap main console applications.

fun map( m : maybestd/core/types/maybe: V -> V<a>, f : (a) -> e b ) : e maybestd/core/types/maybe: V -> V<b>
fun map( e : eitherstd/core/types/either: (V, V) -> V<a,b>, f : (b) -> e c ) : e eitherstd/core/types/either: (V, V) -> V<a,c>

Map over the Rightstd/core/types/Right: forall<a,b> (right : b) -> either<a,b> component of an eitherstd/core/types/either: (V, V) -> V type.

fun map( t : (a, a), f : (a) -> e b ) : e (b, b)
fun map( t : (a, a, a), f : (a) -> e b ) : e (b, b, b)
fun map( t : (a, a, a, a), f : (a) -> e b ) : e (b, b, b, b)
fun map( s : stringstd/core/types/string: V, f : (charstd/core/types/char: V) -> e charstd/core/types/char: V ) : e stringstd/core/types/string: V

Apply a function f to each character in a string.

fun map( v : vectorstd/core/types/vector: V -> V<a>, f : (a) -> e b ) : e vectorstd/core/types/vector: V -> V<b>

Apply a total function f to each element in a vector v.

fun max( i : intstd/core/types/int: V, j : intstd/core/types/int: V ) : intstd/core/types/int: V

Return the maximum of two integers.

fun max( x : doublestd/core/types/double: V, y : doublestd/core/types/double: V ) : doublestd/core/types/double: V

Returns the largest of two doubles.

fun maybe( m : maybestd/core/types/maybe: V -> V<a>, onNothing : b, onJust : (a) -> e b ) : e b

Match a maybestd/core/types/maybe: V -> V value and either return a default value on Nothingstd/core/types/Nothing: forall<a> maybe<a> or apply a function to the value on Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>.

fun maybe( m : maybestd/core/types/maybe: V -> V<a>, nothing : a ) : a

Convert a maybestd/core/types/maybe: V -> V<a> value to a, using the nothing parameter for Nothingstd/core/types/Nothing: forall<a> maybe<a>. This is an alias for default.

fun maybe( e : eitherstd/core/types/either: (V, V) -> V<a,b> ) : maybestd/core/types/maybe: V -> V<b>

Convert a eitherstd/core/types/either: (V, V) -> V to a maybestd/core/types/maybe: V -> V type discarding the value of the Leftstd/core/types/Left: forall<a,b> (left : a) -> either<a,b> constructor and using Juststd/core/types/Just: forall<a> (value : a) -> maybe<a> for the Rightstd/core/types/Right: forall<a,b> (right : b) -> either<a,b> constructor.

fun maybe( b : boolstd/core/types/bool: V ) : maybestd/core/types/maybe: V -> V<types/()>

Transform a boolean to a maybe type, using Nothingstd/core/types/Nothing: forall<a> maybe<a> for Falsestd/core/types/False: bool.

fun maybe( i : intstd/core/types/int: V ) : maybestd/core/types/maybe: V -> V<intstd/core/types/int: V>

Transform an integer to a maybe type, using Nothingstd/core/types/Nothing: forall<a> maybe<a> for 0.

fun maybe( s : stringstd/core/types/string: V ) : maybestd/core/types/maybe: V -> V<stringstd/core/types/string: V>

Transform a string to a maybe type, using Nothingstd/core/types/Nothing: forall<a> maybe<a> for an empty string.

fun mbint( m : maybestd/core/types/maybe: V -> V<intstd/core/types/int: V> ) : intstd/core/types/int: V
fun min( i : intstd/core/types/int: V, j : intstd/core/types/int: V ) : intstd/core/types/int: V

Return the minimum of two integers.

fun min( x : doublestd/core/types/double: V, y : doublestd/core/types/double: V ) : doublestd/core/types/double: V

Returns the smallest of two doubles.

fun mul-exp10( i : intstd/core/types/int: V, n : intstd/core/types/int: V ) : intstd/core/types/int: V
fun negate( i : intstd/core/types/int: V ) : intstd/core/types/int: V
fun notrace(): (ststd/core/types/st: H -> E<globalstd/core/types/global: H>) types/()

Disable tracing completely.

fun o( f : (a) -> e b, g : (c) -> e a ) : ((x : c) -> e b)

Compose two funs f and g.

fun on-exit( hndler : () -> e types/(), action : () -> e a ) : e a

Set a hndler that is always called when the action finishes (either normally or with an exception).

fun once( calc : () -> a ) : (() -> a)

Given a total function to calculate a value a, return a total function that only calculates the value once and then returns the cached result.

fun order( i : intstd/core/types/int: V ) : orderstd/core/types/order: V
fun pad-left( s : stringstd/core/types/string: V, ^width : intstd/core/types/int: V, fill : ?charstd/core/types/char: V ) : stringstd/core/types/string: V

Right-align a string to width width using fill (default is a space) to fill from the left.

fun pad-right( s : stringstd/core/types/string: V, ^width : intstd/core/types/int: V, fill : ?charstd/core/types/char: V ) : stringstd/core/types/string: V

Left-align a string to width width using fill (default is a space) to fill on the right.

fun parse-int( s : stringstd/core/types/string: V, hex : ?boolstd/core/types/bool: V ) : maybestd/core/types/maybe: V -> V<intstd/core/types/int: V>

Parse an integer after trimming whitespace. If an illegal digit character is encountered Nothingstd/core/types/Nothing: forall<a> maybe<a> is returned. An empty string will result in Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(0). A string can start with a - sign for negative numbers, and with 0x or 0X for hexadecimal numbers (in which case the hex parameter is ignored).

fun parse-int-default( s : stringstd/core/types/string: V, default : ?intstd/core/types/int: V, hex : ?boolstd/core/types/bool: V ) : intstd/core/types/int: V

Parse an integer using parseInt. If an illegal digit character is encountered the default value is returned. An empty string will also result in default.

fun phantom(): a
fun pow( i : intstd/core/types/int: V, exp : intstd/core/types/int: V ) : intstd/core/types/int: V

Raise an integer i to the power of exp.

fun print( s : stringstd/core/types/string: V ) : consolestd/core/console: X types/()

Print a string to the console.

fun println( s : stringstd/core/types/string: V ) : consolestd/core/console: X types/()

Print a string to the console, including a final newline character.

fun println( i : intstd/core/types/int: V ) : consolestd/core/console: X types/()

Print an integer to the console, including a final newline character.

fun println( d : doublestd/core/types/double: V ) : consolestd/core/console: X types/()

Print a double to the console, including a final newline character.

fun println( b : boolstd/core/types/bool: V ) : consolestd/core/console: X types/()

Print a boolean to the console, including a final newline character.

fun println( c : charstd/core/types/char: V ) : consolestd/core/console: X types/()

Print a character to the console, including a final newline character.

fun println( u : types/() ) : consolestd/core/console: X types/()

Print a unit value to the console, including a final newline character.

fun repeat( s : stringstd/core/types/string: V, ^n : intstd/core/types/int: V ) : stringstd/core/types/string: V

Repeat a string n times.

fun repeat( ^n : intstd/core/types/int: V, action : () -> e types/() ) : e types/()

The repeat fun executes action n times.

fun replace-all( s : stringstd/core/types/string: V, pattern : stringstd/core/types/string: V, repl : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Replace every occurrence of pattern to repl in a string.

fun show( i : intstd/core/types/int: V ) : stringstd/core/types/string: V

Convert an intstd/core/types/int: V to a string.

fun show-exp( d : doublestd/core/types/double: V, precision : ?intstd/core/types/int: V ) : stringstd/core/types/string: V

Show a doublestd/core/types/double: V in exponential (scientific) notation. The optional precision (= -17) specifies the precision. If >=0 it specifies the number of digits behind the dot (up to 17 max). If negative, then at most the absolute value of precision digits behind the dot are used.

fun show-fixed( d : doublestd/core/types/double: V, precision : ?intstd/core/types/int: V ) : stringstd/core/types/string: V

Show a doublestd/core/types/double: V fixed-point notation. The optional precision (= -2) specifies the maximum precision. If >=0 it specifies the number of digits behind the dot (up to 20 max). If negative, then at most the absolute value of precision digits behind the dot are used. This may still show a number in exponential notation if the it is too small or large, in particular, for a d where d > 1.0e21 or d < 1.0e-15, or if precision.abs > 17, the show-expstd/core/show-exp: (d : double, precision : ?int) -> string routine is used.

fun show-hex( i : intstd/core/types/int: V, width : ?intstd/core/types/int: V, use-capitals : ?boolstd/core/types/bool: V, pre : ?stringstd/core/types/string: V ) : stringstd/core/types/string: V

Show an intstd/core/types/int: V as a hexadecimal value.
The width parameter specifies how wide the hex value is where "0" is used to align.
The use-capitals parameter (= Truestd/core/types/True: bool) determines if captical letters should be used to display the hexadecimal digits.
The pre (="0x") is an optional prefix for the number (goes between the sign and the number).

fun show-tuple( x : (a, b), showfst : (a) -> stringstd/core/types/string: V, showsnd : (b) -> stringstd/core/types/string: V ) : stringstd/core/types/string: V
fun show( d : doublestd/core/types/double: V, precision : ?intstd/core/types/int: V ) : stringstd/core/types/string: V

Show a doublestd/core/types/double: V as a string. If d >= 1.0e-5 and d < 1.0e+21, show-fixedstd/core/show-fixed: (d : double, precision : ?int) -> string is used and otherwise show-expstd/core/show-exp: (d : double, precision : ?int) -> string. Default precision is -17.

fun show( c : charstd/core/types/char: V ) : stringstd/core/types/string: V

Show a charstd/core/types/char: V as a character literal.

fun show( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Show a string as a string literal.

fun show( b : boolstd/core/types/bool: V ) : stringstd/core/types/string: V

Convert a boolstd/core/types/bool: V to a string.

fun show( u : types/() ) : stringstd/core/types/string: V

Convert a unit value () to a string.

fun sign( ^i : intstd/core/types/int: V ) : orderstd/core/types/order: V
fun sign( d : doublestd/core/types/double: V ) : orderstd/core/types/order: V
fun ssize_t( i : intstd/core/types/int: V ) : ssize_tstd/core/types/ssize_t: V

Convert an integer to an ssize_tstd/core/types/ssize_t: V. The number is clamped to the maximal or minimum ssize_tstd/core/types/ssize_t: V value if it is outside the range of an ssize_tstd/core/types/ssize_t: V.

fun starts-with( s : stringstd/core/types/string: V, pre : stringstd/core/types/string: V ) : maybestd/core/types/maybe: V -> V<sslicestd/core/sslice: V>

Is pre a prefix of s? If so, returns a slice of s following pre up to the end of s.

fun string( c : charstd/core/types/char: V ) : stringstd/core/types/string: V

Convert a character to a string.

fun string( vectorstd/core/types/vector: V -> V<charstd/core/types/char: V> ) : stringstd/core/types/string: V

Convert a vector of characters to a string.

fun string( ms : maybestd/core/types/maybe: V -> V<stringstd/core/types/string: V> ) : stringstd/core/types/string: V

Convert a maybestd/core/types/maybe: V -> V string to a string using the empty sting for Nothingstd/core/types/Nothing: forall<a> maybe<a>.

fun tail( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Return the tail of a string (or the empty string).

fun throw( message : stringstd/core/types/string: V, info : ?exception-infostd/core/exception-info: V ) : exnstd/core/exn: HX a

Throw an exception with a specified message.

fun to-lower( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Convert a string to lower-case.

fun to-upper( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Convert a string to upper-case.

fun trace( message : stringstd/core/types/string: V ) : types/()

Trace a message used for debug purposes. The behaviour is system dependent. On a browser and node it uses console.log by default. Disabled if notracestd/core/notrace: () -> (st<global>) () is called.

fun trace-any( message : stringstd/core/types/string: V, x : a ) : types/()
fun trim( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Trim whitespace on the left and right side of a string.

fun trim-left( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Trim the starting white space of a string.

fun trim-left( s : stringstd/core/types/string: V, sub : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Trim off a substring sub while s starts with that string.

fun trim-right( s : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Trim the ending white space of a string.

fun trim-right( s : stringstd/core/types/string: V, sub : stringstd/core/types/string: V ) : stringstd/core/types/string: V

Trim off a substring sub while s ends with that string.

fun truncate( s : stringstd/core/types/string: V, count : intstd/core/types/int: V ) : stringstd/core/types/string: V

Truncate a string to count characters.

fun try( action : () -> <exnstd/core/exn: HX|e> a, hndl : (exceptionstd/core/exception: V) -> e a ) : e a

Catch any exception raised in action and handle it. Use on-exn or on-exitstd/core/on-exit: forall<a,e> (hndler : () -> e (), action : () -> e a) -> e a when appropiate.

fun try-default( value : a, action : () -> <exnstd/core/exn: HX|e> a ) : e a

Return a default value when an exception is raised.

fun unique(): ndetstd/core/types/ndet: X intstd/core/types/int: V

Returns a unique integer (modulo 32-bits).

fun unjust( m : maybestd/core/types/maybe: V -> V<a> ) : exnstd/core/exn: HX a

Get the value of the Juststd/core/types/Just: forall<a> (value : a) -> maybe<a> constructor or raise an exception.

fun unsafe-nodiv( action : () -> <divstd/core/types/div: X|e> a ) : e a

Unsafe. This function removes the non-termination effect (divstd/core/types/div: X) from the effect of an action.

fun unsafe-noexn( action : () -> <exnstd/core/exn: HX|e> a ) : e a

Unsafe. This function removes the exception effect (exnstd/core/exn: HX) from the effect of an action.

fun unsafe-nostate( action : () -> <ststd/core/types/st: H -> E<h>,consolestd/core/console: X> a ) : (() -> consolestd/core/console: X a)

Unsafe. This function removes the non-termination effect (divstd/core/types/div: X) from the effect of an action.

fun vector(): vectorstd/core/types/vector: V -> V<a>

Create an empty vector.

fun vector-init( ^n : intstd/core/types/int: V, f : (intstd/core/types/int: V) -> a ) : vectorstd/core/types/vector: V -> V<a>

Create a new vector of length n with initial elements given by function f .

fun vector( s : stringstd/core/types/string: V ) : vectorstd/core/types/vector: V -> V<charstd/core/types/char: V>

Convert a string to a vector of characters.

fun vector( ^n : intstd/core/types/int: V, default : a ) : vectorstd/core/types/vector: V -> V<a>

Create a new vector of length n with initial elements default .

fun while( predicate : () -> <divstd/core/types/div: X|e> boolstd/core/types/bool: V, action : () -> <divstd/core/types/div: X|e> types/() ) : <divstd/core/types/div: X|e> types/()

The whilestd/core/while: forall<e> (predicate : () -> <div|e> bool, action : () -> <div|e> ()) -> <div|e> () fun executes action as long as pred is true.