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

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 external 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 arraystd/core/array: (H, V) -> V<h,a>

The type of mutable arrays. See also vectorstd/core/vector: V -> V for immutable arrays.

Return the index element of an array. Raises an exception for out-of-bounds access.

Assign to element i in an array a . May raise an out-of-bounds exception

fun array( n : intstd/core/int: V, default : a ) : arraystd/core/array: (H, V) -> V<h,a>

Create a new array of length n with initial elements a .

Create a zero length array

Convert a vector to an array (by making a copy)

Convert a string to an array of characters.

Convert a list to an array.

Invoke a function f for each element in a an array a.
Note: this can diverge by storing self referential functions in the array

Concatenate an array of strings with a separator sep

Destructively apply function f to each element in an array a.
Note: this can diverge by storing self referential functions in the array

type asyncstd/core/async: V -> V<a>

Represents values that are computed asynchronously

Has an asynchronous value been computed?

fun on( async : asyncstd/core/async: V -> V<a>, handler : (value : a) -> e b ) : e asyncstd/core/async: V -> V<b>

When an asynchronous value is computed, call the specified handler (at most once).

When an asynchronous value computation fails, call the specified handler (at most once).

type blockingstd/core/blocking: X

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

type boolstd/core/bool: V

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

con False
con True

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

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

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

type charstd/core/char: V

A unicode character

Substract two character codePoints

Convert a unicode code point to a character

Is the character an ASCII letter ?

Is the character ASCII letter or digit?

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

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 ?

Is the character an upper-case ASCII character ?

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

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

type consolestd/core/console: X

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

type dictstd/core/dict: V -> V<a>

A dictionary is a map from strings to values

Return the value at a specified key

Append a list of key/value pairs to a dictionary.

Append two dictionaries.

Create a new dictionary from a liststd/core/list: V -> V of key value pairs.

Create a new dictionary from a vectorstd/core/vector: V -> V of key/value pairs.

Execute action for each key/value pair in a dictionary.

Map a function over the values in a dictionary.

type divstd/core/div: X

The divergence effect: a divergent function may not terminate.

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 ?

Is this value equal to NaN ?

Is this value equal to negative infinity ?

Is this value equal to positive infinity ?

Returns the largest of two doubles

The maximal double value

Returns the smallest of two doubles

The minimal double value

Represents a value that is not a number (NaN)

Negative infinity

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 as a string with a default precision of 0 . Pass a precision of 0 (or less) to display numbers precisely. Uses either showFixedstd/core/showFixed: (d : double, precision : ?int) -> string or showExpstd/core/showExp: (d : double, precision : ?int) -> string depending on what is the most compact representation

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

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 .

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(left : b)
type exceptionstd/core/exception: V

Exceptions

Return a system dependent description of an exception

type exnstd/core/exn: X

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

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 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 functions 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) == D `sar` 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 minIntstd/core/minInt: int 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 maxIntstd/core/maxInt: int).

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 minIntstd/core/minInt: int (since the negation of minIntstd/core/minInt: int 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 .

Convert a character to its unicode code point

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. Raises an overflow exception if the double is larger than maxIntstd/core/maxInt: int or smaller than minIntstd/core/minInt: int.

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.

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)

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.

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

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 functions 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. Raise an exception on an out-of-bounds access.

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)

Concatenate the result lists from applying a function to all elements

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]

Find the first element satisfying some predicate

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> (list<a>, b, (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( liststd/core/list: V -> V<a>, b, (a, b) -> e b ) : e b

Fold a list from the right, i.e. foldr([1,2],0,(+)) == 1+(2+0) See also foldlstd/core/foldl: forall<a,b,e> (list<a>, b, (b, a) -> e b) -> e b

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.

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

Return the list without its last element. Raise an exception if an empty list is passed

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

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

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.

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

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

Convert an array to a list

Convert a vector to a list.

Convert a dictionary to a list of key/value pairs

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.

fun mapIndexed( 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.

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)

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

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

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.

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> (unJust : 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(unJust : a)
con Nothing

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

Automatically generated. Tests for the Nothingstd/core/Nothing: forall<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> (unJust : a) -> maybe<a>

Automatically generated. Retrieves the unJust constructor field of the maybestd/core/maybe: V -> V type.

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 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 isNone( 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 isOptional( 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.

fun value( optional : ?a ) : exnstd/core/exn: X a

Automatically generated. Retrieves the value constructor field 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>

The read effect: signifies that a function may read from from heap 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 functions 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>)
fun head( stream : streamstd/core/stream: V -> V<a> ) : a

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

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

type stringstd/core/string: V

A unicode string

Return the n th character in a string s . Raise an out-of-bounds exception if n < 0 or n >= s.length.

RightAlign a string to width width using char (default is a space) to fill from the left.

Does string s contain the character c ?

Does string s contain the string sub ?

Count the number of occurrences of a character in a string

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

Does string s end with post ?

Raise an exception with a specified message.

Invoke a function for each character in a string

Return the length of a string.

Apply a function f to each character in a string

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

Print a string to the console.

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

Displays query to the user (with a space attached) and invokes handler with the user's response.

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 vector of characters to a string.

Convert a character to a oneElement string

Construct a string of n characters c (or the empty string if n <= 0 )

Return a substring from start position start up to either the end of the string, or of at most length len

Trace a message used for debug purposes. The behaviour is system dependent. On a browser and node it uses console.log by default.

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

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 function f to each element in a vector v

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

Create an empty vector.

Convert a string to a vector of characters.

Convert an array to a vector (to guarantee safety, a copy is made)

Convert a list to a vector.

Convert a dictionary to a vector of key/value pairs

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>

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

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, handler : (exceptionstd/core/exception: V) -> e a ) : e a

Catch an exception raised by errorstd/core/error: forall<a> (string) -> exn a and handle it.

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 functions returns its first argument and ignores the second.

fun finally( action : () -> e a, handler : () -> e ()std/core/(): V ) : e a

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

fun id( x : a ) : a

The identify function returns its argument unchanged.

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

Add the divergent effect to a function effect.

fun injectExn( (a) -> e b ) : ((a) -> <exnstd/core/exn: X|e> b)

Add the exception effect to a function effect.

fun injectIo( (a) -> e b ) : totalstd/core/total: E ((a) -> <iostd/core/io: E|e> b)

Add the io effect to a function effect.

fun injectNdet( (a) -> e b ) : totalstd/core/total: E ((a) -> <ndetstd/core/ndet: X|e> b)

Add the ndet effect to a function effect.

fun injectRead( (a) -> e b ) : totalstd/core/total: E ((a) -> <readstd/core/read: H -> X<h>|e> b)

Add the read effect to a function effect.

fun injectSt( (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 injectWrite( (a) -> e b ) : totalstd/core/total: E ((a) -> <writestd/core/write: H -> X<h>|e> b)

Add the write effect to a function effect.

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

Used by the compiler to wrap main console applications

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

Compose two functions f and g.

fun onExit( handler : () -> e ()std/core/(): V, action : () -> e a ) : e a

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

fun onFail( handler : (exceptionstd/core/exception: V) -> <exnstd/core/exn: X|e> ()std/core/(): V, action : () -> <exnstd/core/exn: X|e> a ) : <exnstd/core/exn: X|e> a

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

fun onSuccess( handler : () -> e ()std/core/(): V, action : () -> e a ) : e a

Set a handler that is called if action returns without raising an exception.

fun readln( handler : (stringstd/core/string: V) -> <consolestd/core/console: X|e> a ) : <consolestd/core/console: X|e> ()std/core/(): V

Read a line from the console and immediately supply a handler For convenience, returns a unit value. Use an explicit onstd/core/on: forall<a,b,e> (async : async<a>, handler : (value : a) -> e b) -> e async<b> if the returned asyncstd/core/async: V -> V is needed.

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 function. See also: State in Haskell, by Simon Peyton Jones and John Launchbury.

fun unsafeNoDiv( 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 unsafeNoExn( 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 unsafeTotal( 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

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