std/core documentation

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).

struct ()std/core/(): 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.

type <>std/core/(<>): E

The total effect represents the absence of any effect.

type <|>std/core/(<|>): (X, E) -> E<a,e>

The effect constructor extends an effect with another effect.

type allocstd/core/alloc: H -> X<h>

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

type anystd/core/any: V

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 ?

type asyncstd/core/async: HX

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

type blockingstd/core/blocking: X

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

type boolstd/core/bool: V
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.

type charstd/core/char: V

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.

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

type consolestd/core/console: X

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.

type cpsstd/core/cps: HX

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

type divstd/core/div: X
type doublestd/core/double: V

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 double.

Return the largest integer equal or less than d.

Is this value equal to negative or positive infinity ?

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 this value equal to negative infinity ?

Positive infinity.

Is this value equal to positive infinity ?

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.

Show a doublestd/core/double: V in exponential (scientific) notation.

Show a doublestd/core/double: V as a string with a default precision of 0 . Pass a precision of 0 (or less) to display numbers precisely. 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 .

Convert a doublestd/core/double: V to intstd/core/int: V using roundstd/core/round: (d : double) -> double to round the double to its nearest integer. if the double is larger than maxInt or smaller than minInt just the lower 32 bits are returned.

type eitherstd/core/either: (V, V) -> V<a,b>

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

con Left(left : a)
con Right(right : b)
type exceptionstd/core/exception: V

Exceptions.

Return a system dependent description of an exception.

Throw an exception.

type exnstd/core/exn: X
type filestd/core/file: X

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

type globalstd/core/global: H

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

type handledstd/core/handled: HX -> X<a>

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

type handled1std/core/handled1: HX1 -> X<a>

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

type hdivstd/core/hdiv: (H, V, E) -> P<h,a,e>

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.

type intstd/core/int: V

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

Euclidean-0 modulus. See (/):(x : intstd/core/int: V, y : intstd/core/int: V) -> intstd/core/int: V division for more information.

Euclidean-0 division. 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 )

Note that an interesting edge case is minInt / -1 which equals minInt since in modulo 32-bit arithmetic minInt == -1 * minInt == -1 * (minInt / -1) + (minInt % -1) satisfying property (1). Of course (minInt + 1) / -1 is again positive (namely maxInt).

See also Division and modulus for computer scientists, Daan Leijen, 2001 for further information available at: http://​research.​microsoft.​com/​pubs/​151917/​divmodnote.​pdf .

Return the absolute value of an integer. Raises an exception if the intstd/core/int: V is minInt (since the negation of minInt equals itself and is still negative).

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

The number of bits in an intstd/core/int: V (always 32).

Returns Truestd/core/True: bool if the integer i is an even number.

Executes action for each integer between start upto end (including both start and end ). If start > end the function returns without any call to action .

Executes action for each integer between start upto end (including both start 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.

Do not use. Used by the compiler for platforms that do not support 32 bit truncated division natively.

Do not use. Used by the compiler for platforms that do not support 32 bit truncated modulus natively.

Do not use. Used by the compiler for platforms that do not support 32 bit multiplication natively.

Convert a doublestd/core/double: V to an intstd/core/int: V using roundstd/core/round: (d : double) -> double to round to its nearest integer. If the double is larger than maxInt or smaller than minInt this returns default (=0).

Return the maximum of two integers.

The maximal integer value before overflow happens.

Return the minimum of two integers.

The minimal integer value before underflow happens.

Negate an integer.

Bitwise not of an intstd/core/int: V, i.e. flips all bits.

Returns Truestd/core/True: bool if the integer i is an odd number.

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.

Bitwise rotate an intstd/core/int: V n bits to the left. Does not rotate when n is negative.

Bitwise rotate an intstd/core/int: V n bits to the right. Does not rotate when n is negative.

Arithmetic shift an intstd/core/int: V to the right by n bits. Preserves the sign bit. Returns i when n is negative. When n >= bitsInt returns either -1 when i<0, or 0 when i>=0.

Shift an intstd/core/int: V i to the left by n bits. Returns i when n is negative, or 0 when n >= bitsInt.

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 Uses capital letters for hexadecimal digits by default.

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

Logical shift an intstd/core/int: V to the right by n bits. Shift in zeros from the left. Returns i when n is negative, or 0 when n >= bitsInt.

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.

alias iostd/core/io: E = <exnstd/core/exn: X,divstd/core/div: X,ndetstd/core/ndet: X,consolestd/core/console: X,netstd/core/net: X,filestd/core/file: X,uistd/core/ui: X,ststd/core/st: H -> E<globalstd/core/global: H>>

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

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 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 (odd(i)) 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.

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

Concatenate all strings in a list.

Concatenate all strings in a list using a specific separator.

Return the last element of a list. Raise an exception if the empty list is passed.

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.

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 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 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 if the list is not empty Note: if a maybestd/core/maybe: V -> V type is inconvenient, you can use drop(1) to return an empty list if the input list was 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.

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.

type maybestd/core/maybe: V -> V<a>

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

type ndetstd/core/ndet: X

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

type netstd/core/net: X

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

type operationstd/core/operation: V -> V<a>

Effect operations with result type a.

type operationstd/core/operation: V -> V<a>
type operationstd/core/operation: V -> V<a>
type optionalstd/core/optional: V -> V<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.

type orderstd/core/order: V

An enumeration to represent order.

con Eq
con Gt
con Lt

Automatically generated. Tests for the Eqstd/core/Eq: order constructor of the orderstd/core/order: V type.

Automatically generated. Tests for the Gtstd/core/Gt: order constructor of the orderstd/core/order: V type.

Automatically generated. Tests for the Ltstd/core/Lt: order constructor of the orderstd/core/order: V type.

alias purestd/core/pure: E = <exnstd/core/exn: X,divstd/core/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.

type readstd/core/read: H -> X<h>
type refstd/core/ref: (H, V) -> V<h,a>

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.

alias ststd/core/st: H -> E<h> = <readstd/core/read: H -> X<h>,writestd/core/write: H -> X<h>,allocstd/core/alloc: H -> X<h>>

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

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

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.

type stringstd/core/string: V

A unicode string.

The functions vector and string convert between strings and a vector unicode characters.

Various functions allow indexing into a string, for example ([]) : (stringstd/core/string: V,intstd/core/int: V) -> charstd/core/char: V and substr. With respect to indexing, strings are viewed as a utf-16 encoded array; this means that unicode characters with a value larger than 0xFFFF are represented by two characters in a utf-16 encoding; in other words, we view characters between \uD800 and \uDFFF as another kind of unicode combining characters. When converting to a vector or list of characters though, such surrogate pairs are automatically combined.

The reason for defining strings this way is to allow more effient compilation to Javascript and C#. When compiling natively and using utf-8 encoding, it is still possible to efficiently support this string interface.

Are two strings equal? Uses exact equality between characters.

Return the n th character in a string s . Returns the replacement character (65533) if the index is out-of-bounds.

Choose a non-empty string.

If the first character of a string is ASCII lower?std/core/lower?: (c : char) -> bool convert it to uppercase.

Compare two strings. Uses the character values for comparison.

Does string s contain the string sub ?

Count occurences of pattern 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 ?

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.

Invoke a function for each character in a string.

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

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

Return the character length of a string.

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 default value is returned. An empty string will also result in default.

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.

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

Convert a character to a string.

Convert a vector of characters to a string.

Convert a list of characters to a string.

Return a substring from start position start up to the end of the string. If the start is negative, the start index is calculated from the end of the string as: s.length + start.

Return a substring from start position start up to the end of the string or at most len characters. If the start is negative, the start index is calculated from the end of the string as: s.length + start.

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 len characters.

alias totalstd/core/total: E = totalstd/core/total: E

An alias for the empty effect.

type uistd/core/ui: X

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

type vectorstd/core/vector: V -> V<a>

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 default .

Convert a list to a vector.

Convert a vector to a list with an optional tail.

type voidstd/core/void: V

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.

type writestd/core/write: H -> X<h>
type yldstd/core/yld: V -> V<a>

The Yield monad.

con Result(result : a)

Automatically generated. Tests for the Resultstd/core/Result: forall<a> (result : a) -> yld<a> constructor of the yldstd/core/yld: V -> V type.

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 conststd/core/const: forall<a,b> (x : a, y : b) -> a funs returns its first argument and ignores the second.

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( action : () -> <exnstd/core/exn: X|e> ()std/core/(): V ) : e ()std/core/(): V

Ignore any Exceptions.

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

Inject the cpsstd/core/cps: HX effect.

fun incpsx( action : (a) -> e b ) : totalstd/core/total: E ((a) -> <cpsstd/core/cps: HX|e> b)

Inject the cpsstd/core/cps: HX effect from a non-cps function.

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.

fun notrace(): (ststd/core/st: H -> E<globalstd/core/global: H>) ()std/core/(): V

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

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