std/core▲toc

This module defines standard operations that are always available.

Some types and operations are required to be defined for the compiler to work correctly (i.e. types like intstd/core/int: V or liststd/core/list: V -> V).

The unit type ()std/core/(): V is inhabited by just a single value, namely (). See also the voidstd/core/void: V type and the boolstd/core/bool: V type.

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

Convert a unit value () to a string.

struct (,)std/core/(,): (V, V) -> V<a,b>(fst : asnd : b)

A pair of values a and b.

fun fst( (a, b) ) : a

Automatically generated. Retrieves the fst constructor field of the (,) type.

fun map( t : (a, a), f : (a) -> e b ) : e (b, b)
fun show-tuple( x : (a, b), showfst : (a) -> stringstd/core/string: V, showsnd : (b) -> stringstd/core/string: V ) : stringstd/core/string: V
fun snd( (a, b) ) : b

Automatically generated. Retrieves the snd constructor field of the (,) type.

struct (,,)std/core/(,,): (V, V, V) -> V<a,b,c>(fst : asnd : bthd : c)

A triple of values.

fun fst( (a, b, c) ) : a

Automatically generated. Retrieves the fst constructor field of the (,,) type.

fun map( t : (a, a, a), f : (a) -> e b ) : e (b, b, b)
fun snd( (a, b, c) ) : b

Automatically generated. Retrieves the snd constructor field of the (,,) type.

fun thd( (a, b, c) ) : c

Automatically generated. Retrieves the thd constructor field of the (,,) type.

struct (,,,)std/core/(,,,): (V, V, V, V) -> V<a,b,c,d>(fst : asnd : bthd : cfield4 : d)

A quadruple of values.

fun field4( (a, b, c, d) ) : d

Automatically generated. Retrieves the field4 constructor field of the (,,,) type.

fun fst( (a, b, c, d) ) : a

Automatically generated. Retrieves the fst constructor field of the (,,,) type.

fun map( t : (a, a, a, a), f : (a) -> e b ) : e (b, b, b, b)
fun snd( (a, b, c, d) ) : b

Automatically generated. Retrieves the snd constructor field of the (,,,) type.

fun thd( (a, b, c, d) ) : c

Automatically generated. Retrieves the thd constructor field of the (,,,) type.

struct (,,,,)std/core/(,,,,): (V, V, V, V, V) -> V<a,b,c,d,a1>(fst : asnd : bthd : cfield4 : dfield5 : a1)

A quintuple of values.

fun field4( (a, b, c, d, a1) ) : d

Automatically generated. Retrieves the field4 constructor field of the (,,,,) type.

fun field5( (a, b, c, d, a1) ) : a1

Automatically generated. Retrieves the field5std/core/field5: forall<a,b,c,d,a1> ((a, b, c, d, a1)) -> a1 constructor field of the (,,,,) type.

fun fst( (a, b, c, d, a1) ) : a

Automatically generated. Retrieves the fst constructor field of the (,,,,) type.

fun snd( (a, b, c, d, a1) ) : b

Automatically generated. Retrieves the snd constructor field of the (,,,,) type.

fun thd( (a, b, c, d, a1) ) : c

Automatically generated. Retrieves the thd constructor field of the (,,,,) type.

The total effect represents the absence of any effect.

The effect constructor extends an effect with another effect.

The alloc effect signifies a function may allocate in a heap h.

An any type. Used for extern calls.

fun any( xs : liststd/core/list: V -> V<a>, predicate : (a) -> e boolstd/core/bool: V ) : e boolstd/core/bool: V

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

Asynchronous operations have the asyncstd/core/async: HX effect.

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

The type of booleans has two inhabitants: Truestd/core/True: bool and Falsestd/core/False: bool.

con False
con True

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

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

Automatically generated. Tests for the Falsestd/core/False: bool constructor of the boolstd/core/bool: V type.

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

Return a random boolean.

Automatically generated. Tests for the Truestd/core/True: bool constructor of the boolstd/core/bool: V type.

A unicode character. Characters are unicode codepoints. This is different from a unicode grapheme which represents a single displayed symbol and can consists of multiple codepoints due to combining characters and marks. (see also the std/unicode module.).

Add two character code points.

Substract two character codePoints.

Is the character ASCII letter or digit?

Is the character an ASCII letter ?

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

Convert a unicode code point to a character.

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

Is the character an ASCII digit ?

Is the character an ASCII hexa-decimal digit ?

Is the character a lower-case ASCII character ?

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

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

Is the character an upper-case ASCII character ?

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

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

alias contstd/core/cont: (V, E, V) -> V<a,e,b> = (a) -> e b

Continuation alias. Used internally to do special checks on cps converted code.

Cps effect. This is used by the compiler internally to ensure certain funs are compiled with a cps translation.

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.

The divergence effect: a divergent function may not terminate.

A 64-bit IEEE 754 floating point value.

Returns the value d raised to the power p .

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

Return the smallest integer equal or larger than d.

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

Return the largest integer equal or less than d.

Return the fractional part of a doublestd/core/double: V d.
d.trunc + d.fraction === d
(~2.4).fraction === ~0.4.

Is this value equal to negative or positive infinity ?

Return the natural logarithm (in base e) of a doublestd/core/double: V d.

Return the logarithm in base 10 of a doublestd/core/double: V d.

Return the logarithm in base 2 of a doublestd/core/double: V d.

The maximal double value.

Returns the largest of two doubles.

The minimal double value.

Returns the smallest of two doubles.

Represents a value that is not a number (NaN).

Is this value equal to NaN ?

Negative infinity.

Is the value negative?

Is this value equal to negative infinity ?

Positive infinity.

Is the value positive?

Is this value equal to positive infinity ?

Return the d raised to the power of p.

Return the 10 to the power of p.

Return the 2 to the power of p.

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

Return a random number equal or larger than 0.0 and smaller than 1.0.

Round a double to its nearest integral value. If the value is halfway between two integers, the value is rounded to the even one.

Round a double to a specified precision.

Show a doublestd/core/double: V in exponential (scientific) notation. The optional precision (= 0) should be between 0 and 21. Use 0 to display the number precisely using the least digits necessary.

Show a doublestd/core/double: V as in decimal notation. The optional precision (= 0) and should be between 0 and 21. Use 0 to display the number precisely using the least digits necessary.

Show a doublestd/core/double: V as a string. The option precision (= 0) should a number be between 0 and 21. use 0 to display the number precisely using the least digits necessary. Uses either showFixed or showExp depending on what is the most compact representation.

Return the square root of a value d Returns nanstd/core/nan: double if d == nan or if d is negative. Returns inf if d == inf .

Return the integral part of a doublestd/core/double: V d . If d >= 0.0 , return the largest integer equal or less to d , If d < 0.0 , return the smallest integer equal or larger to d .

Is the value zero?

The choice type represents one of two possible types a or b.

con Left(left : a)
con Right(right : b)

Exceptions.

Return a system dependent description of an exception.

Throw an exception.

The exception effect: a partial function may raise an exception.

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

The globalstd/core/global: H heap is a special heap constant to denote the global shared heap.

Handled effects are lifted to an atomic effect using the handledstd/core/handled: HX -> X type constructor.

Linear effects are lifted to an atomic effect using the handled1std/core/handled1: HX1 -> X type constructor.

The predicate hdivstd/core/hdiv: (H, V, E) -> P<h,a,e> signifies that if the type a contains a reference to h, then the effect e must contain the divergent effect (divstd/core/div: X). This constraint is generated when writing to the heap (see !) and is necessary to catch cases where code can diverge by storing selfReferential funs in the heap.

A 32-bit signed integer (using two's complement to represent negative numbers).

Are two integers not equal?

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

Multiply two integers.

Substract two integers.

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

Is the first integer smaller than the second?

Is the first integer smaller or equal to the second?

Are two integers equal?

Is the first integer greater than the second?

Is the first integer greater or equal to the second?

Negate an integer.

Return the absolute value of an integer.

The number of bits in a doublestd/core/double: V (64).

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

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%(2^n) == D & ((2^n) - 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 .

Is this an even integer?

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

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

Convert a character to its unicode code point.

Return the maximum of two integers.

Return the minimum of two integers.

Is the integer negative (stricly smaller than zero).

Is this an odd integer?

Is the integer positive (stricly greater than zero).

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

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

Return a positive random integer (including 0).

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

The repeat fun executes action n times.

Show an intstd/core/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/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).

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

Returns a unique integer (modulo 32-bits).

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

Wait (asynchronously) for ms milliseconds. Use wait(0) to yield to other asynchronous operations.

Is this equal to zero?

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

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 Nil

The empty list.

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

A head element followed by the tail of the list.

Append two lists.

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

fun all( xs : liststd/core/list: V -> V<a>, predicate : (a) -> e boolstd/core/bool: V ) : e boolstd/core/bool: V

Do all elements satisfy a predicate ?

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: filter([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],fun(i) { if (i.odd?) then Nothingstd/core/Nothing: forall<a> maybe<a> else Juststd/core/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.

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

Fold a list from the left, i.e. foldl([1,2],0,(+)) == (0+1)+2 Since foldlstd/core/foldl: forall<a,b,e> (list<a>, b, (b, a) -> e b) -> e b is tail recursive, it is preferred over foldrstd/core/foldr: forall<a,b,e> (xs : list<a>, z : b, f : (a, b) -> e b) -> e b when using an associative function f.

fun foldl1( xs : liststd/core/list: V -> V<a>, f : (a, a) -> <exnstd/core/exn: X|e> a ) : <exnstd/core/exn: X|e> a
fun foldr( xs : liststd/core/list: V -> V<a>, z : b, f : (a, b) -> e b ) : e b

Fold a list from the right, i.e. foldr([1,2],0,(+)) == 1+(2+0) Note, foldrstd/core/foldr: forall<a,b,e> (xs : list<a>, z : b, f : (a, b) -> e b) -> e b is less efficient than foldlstd/core/foldl: forall<a,b,e> (list<a>, b, (b, a) -> e b) -> e b as it reverses the list first.

fun foldr1( xs : liststd/core/list: V -> V<a>, f : (a, a) -> <exnstd/core/exn: X|e> a ) : <exnstd/core/exn: X|e> a
fun foreach( xs : liststd/core/list: V -> V<a>, action : (a) -> e ()std/core/(): V ) : e ()std/core/(): V

Invoke action for each element of a list.

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/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 defaultstd/core/default: forall<a> (m : maybe<a>, nothing : a) -> a 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 .

Append end to each string in the list xs and join them all together.
join-end([],end) === ""
join-end(["a","b"],"/") === "a/b/".

Concatenate all strings in a list.

Concatenate all strings in a list using a specific separator.

Return the last element of a list (or Nothingstd/core/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 defaultstd/core/default: forall<a> (m : maybe<a>, nothing : a) -> a 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.

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.

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

Convert a maybestd/core/maybe: V -> V type to a list type.

Convert a string to a list of characters.

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/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/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 defaultstd/core/default: forall<a> (m : maybe<a>, nothing : a) -> a (=0) for the empty list).

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

Returns the smallest element of a list of integers (or defaultstd/core/default: forall<a> (m : maybe<a>, nothing : a) -> a (=0) for the empty list).

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

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

Partition a list in two lists where the first list contains those elements that satisfy the given predicate pred. For example: partition([1,2,3],odd?) == ([1,3],[2]).

Remove those elements of a list that satisfy the given predicate pred. For example: remove([1,2,3],odd?) == [2].

Create a list of n repeated elementes x.

Reverse a list.

Convert a list to a string.

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

Returns a singleton list.

split a list at position n.

Return the sum of a list of integers.

Return the sum of a list of doubles.

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.

Join a list of strings with newlines.

Unzip a list of pairs into two lists.

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.

The maybestd/core/maybe: V -> V type is used to represent either a value (Juststd/core/Just: forall<a> (value : a) -> maybe<a>(x)) or Nothingstd/core/Nothing: forall<a> maybe<a>. This type is often used to represent values that can be null.

con Just(value : a)
con Nothing

Automatically generated. Tests for the Juststd/core/Just: forall<a> (value : a) -> maybe<a> constructor of the maybestd/core/maybe: V -> V type.

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

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

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

Automatically generated. Tests for the Nothingstd/core/Nothing: forall<a> maybe<a> constructor of the maybestd/core/maybe: V -> V type.

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

NonDeterminism: a nonDeterministic function may return varying results even when called with the same input values.

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

Effect operations with result type a.

Optional is used internally by the compiler to pass optional arguments. It is usually displayed as :?a for some type a.

con None

Nonestd/core/None: forall<a> ?a is used when an optional argument is not provided.

con Optional(value : a)

The Optionalstd/core/Optional: forall<a> (value : a) -> ?a constructor is used when an optional argument is given.

fun none?( optional : ?a ) : boolstd/core/bool: V

Automatically generated. Tests for the Nonestd/core/None: forall<a> ?a constructor of the optionalstd/core/optional: V -> V type.

fun optional?( optional : ?a ) : boolstd/core/bool: V

Automatically generated. Tests for the Optionalstd/core/Optional: forall<a> (value : a) -> ?a constructor of the optionalstd/core/optional: V -> V type.

An enumeration to represent order.

con Eq
con Gt
con Lt

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.

The read effect: signifies that a function may read from from heap h.

A reference refstd/core/ref: (H, V) -> V<h,a> points to a value of type a in heap h.

Read the value of reference.

Allocate a fresh reference with an initial value.

Assign a new value to a reference.

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".first.advance(1).string == "b", "abc".first.advance(3).string == "", * "abc".last.advance(~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.

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

An empty slice.

Is a slice empty?

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".first.extend(1).string == "ab" "abc".last.extend(~1).string == "".

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

Apply a function for each character in a string slice.

Is a slice not empty?

Stateful funs can manipulate heap h using allocations, reads and writes.

A streamstd/core/stream: V -> V is a co-inductive type reprenting 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.

A unicode string is a sequence of unicode characters (charstd/core/char: (int) -> char). The encoding of a string is internal and not exposed and there is no direct indexing of characters in string. Use the sslicestd/core/sslice: V type for efficient matching and retrieving sub-strings from string.
See also the std/string module.

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

Choose a non-empty string.

Convert the first character of a string to uppercase.

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

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

Does string s contain the string sub ?

Count occurences of pattern in a string.

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

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

Is a string empty?

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

Raise an exception with a specified message.

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

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

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

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

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

Invoke a function for each character in a string.

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

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

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

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

Split a string into a list of lines.

Apply a function f to each character in a string.

Is a string not empty?

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

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

Parse an integer after trimming whitespace. If an illegal digit character is encountered Nothingstd/core/Nothing: forall<a> maybe<a> is returned. An empty string will result in Juststd/core/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).

Parse an integer using parseInt. If an illegal digit character is encountered the defaultstd/core/default: forall<a> (m : maybe<a>, nothing : a) -> a value is returned. An empty string will also result in defaultstd/core/default: forall<a> (m : maybe<a>, nothing : a) -> a.

Print a string to the console.

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

Repeat a string n times.

Replace every occurrence of pattern to repl in a string.

Show a string as a string literal.

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

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"].

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

Convert a character to a string.

Convert a vector of characters to a string.

Convert a list of characters to a string.

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.

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

Convert a string to lower-case.

Convert a string to upper-case.

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.

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

Trim the starting white space of a string.

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

Trim the ending white space of a string.

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

Truncate a string to count characters.

An alias for the empty effect.

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

The type of immutable arrays is called vectorstd/core/vector: V -> V.

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

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

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

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

Concatenate a vector of strings.

Concatenate a vector of strings with a separator sep.

Return the length of a vector.

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

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

Create an empty vector.

Convert a string to a vector of characters.

Create a new vector of length n with initial elements defaultstd/core/default: forall<a> (m : maybe<a>, nothing : a) -> a .

Convert a list to a vector.

Convert a vector to a list with an optional tail.

The voidstd/core/void: V type is empty and has no constructors. See also the ()std/core/(): V unit type and the boolstd/core/bool: V type.

The write effect: signifies that a function may write to heap h.

The Yield monad.

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

Apply a function f to a specified argument x.

fun catch( action : () -> <exnstd/core/exn: X|e> a, hndl : (exceptionstd/core/exception: V) -> e a ) : e a
fun choose( x : a, y : a ) : ndetstd/core/ndet: X a

Returns one of its arguments x or y based on a non-deterministic choice.

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 finally( action : () -> e a, hndl : () -> e ()std/core/(): V ) : e a

Execute a hndler no matter what exception was raised in action. Use of on-exitstd/core/on-exit: forall<a,e> (hndler : () -> e (), action : () -> e a) -> e a is preferred (which has its arguments swapped).

fun id( x : a ) : a

The identity function returns its argument unchanged.

fun ignore( x : a ) : ()std/core/(): V

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

fun incps( action : () -> e a ) : <cpsstd/core/cps: HX|e> a

inject the cpsstd/core/cps: HX effect into a non-cps function.

fun incps1( action : (a) -> e b, x : a ) : <cpsstd/core/cps: HX|e> b

inject the cpsstd/core/cps: HX effect into a non-cps function with one argument.

fun incps2( action : (a, b) -> e c, x : a, y : b ) : <cpsstd/core/cps: HX|e> c

inject the cpsstd/core/cps: HX effect into a non-cps function with two arguments.

fun inject-div( () -> e a ) : (() -> <divstd/core/div: X|e> a)

Add the divergent effect to a function effect.

fun inject-div( (a) -> e b ) : ((a) -> <divstd/core/div: X|e> b)

Add the divergent effect to a function effect.

fun inject-st( (a) -> e b ) : totalstd/core/total: E ((a) -> <ststd/core/st: H -> E<h>|e> b)

Add the state effect to a function effect.

fun inject-st( () -> e a ) : totalstd/core/total: E (() -> <ststd/core/st: H -> E<h>|e> a)

Add the state effect to a function effect.

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

Used by the compiler to wrap main console applications.

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 ()std/core/(): V, action : () -> e a ) : e a

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

fun on-exn( value : a, action : () -> <exnstd/core/exn: X|e> a ) : e a

Return a default value when an exception is raised.

fun on-fail( hndler : () -> <exnstd/core/exn: X|e> ()std/core/(): V, action : () -> <exnstd/core/exn: X|e> a ) : <exnstd/core/exn: X|e> a

Set a hndler that is called when an exception is raised in the action block.

fun on-success( hndler : () -> e ()std/core/(): V, action : () -> e a ) : e a

Set a hndler that is called if action returns without raising 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 run( action : forall<h> () -> <ststd/core/st: H -> E<h>|e> a ) : e a

If a heap effect is unobservable, the heap effect can be erased by using the runstd/core/run: forall<e,a> (action : forall<h> () -> <st<h>|e> a) -> e a fun. See also: State in Haskell, by Simon Peyton Jones and John Launchbury.

val uncps( action : () -> <cpsstd/core/cps: HX|e> a ) : e a

Handle the cpsstd/core/cps: HX effect.

fun unsafe-decreasing( x : a ) : a

Unsafe. Mark a function parameter as decreasing to suppress the non-termination effect (divstd/core/div: X).

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

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

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

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

fun unsafe-total( action : () -> e a ) : totalstd/core/total: E a

Unsafe. This function calls a function and pretends it did not have any effect at all.