Used by the compiler to wrap main console applications.
Core types.
Internal effect handler primitives.
The blockingstd/core/blocking: X
effect signifies that a function may block.
The console effect signifies that a function may write to the console.
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.
Create a new delayedstd/core/delayed: (E, V) -> V
value.
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.
An errorstd/core/error: V -> V
type represents a first-class exception result.
Use default value def
in case of an error.
Transform an errorstd/core/error: V -> V
type to an eitherstd/core/types/either: (V, V) -> V
value.
Automatically generated. Tests for the Errorstd/core/Error: forall<a> (exception : exception) -> error<a>
constructor of the errorstd/core/error: V -> V
type.
Automatically generated. Tests for the Okstd/core/Ok: forall<a> (result : a) -> error<a>
constructor of the errorstd/core/error: V -> V
type.
Transform an errorstd/core/error: V -> V
type to a maybestd/core/types/maybe: V -> V
value.
Transform an exception effect to an errorstd/core/error: V -> V
type.
Transform an errorstd/core/error: V -> V
type back to an exn
effect.
The exception data type.
Automatically generated. Retrieves the infostd/core/info: (exception : exception) -> exception-info
constructor field of the exceptionstd/core/exception: V
type.
Automatically generated. Retrieves the messagestd/core/message: (exception : exception) -> string
constructor field of the exceptionstd/core/exception: V
type.
Show the exception message.
call throw-exnstd/core/throw-exn: forall<a> (exn : exception) -> exn a
operation of the exnstd/core/exn: HX
effect.
Exception information.
Automatically generated. Tests for the ExnAssertstd/core/ExnAssert: exception-info
constructor of the exception-infostd/core/exception-info: V
type.
Automatically generated. Tests for the ExnErrorstd/core/ExnError: exception-info
constructor of the exception-infostd/core/exception-info: V
type.
Automatically generated. Tests for the ExnInternalstd/core/ExnInternal: (name : string) -> exception-info
constructor of the exception-infostd/core/exception-info: V
type.
Automatically generated. Tests for the ExnPatternstd/core/ExnPattern: (location : string, definition : string) -> exception-info
constructor of the exception-infostd/core/exception-info: V
type.
Automatically generated. Tests for the ExnRangestd/core/ExnRange: exception-info
constructor of the exception-infostd/core/exception-info: V
type.
Automatically generated. Tests for the ExnSystemstd/core/ExnSystem: (errno : int) -> exception-info
constructor of the exception-infostd/core/exception-info: V
type.
Automatically generated. Tests for the ExnTodostd/core/ExnTodo: exception-info
constructor of the exception-infostd/core/exception-info: V
type.
Exceptions.
Transform an errorstd/core/error: V -> V
type back to an exn
effect.
The fsysstd/core/fsys: X
effect signifies a function may access the file system.
The global-scopestd/core/global-scope: S
is a special type constant to denote the global scope.
The iostd/core/io: E
effect is used for functions that perform arbitrary I/O operations.
The io-noexnstd/core/io-noexn: E
effect is used for functions that perform arbitrary I/O operations, but raise no exceptions.
The io-totalstd/core/io-total: E
effect is used for functions that perform arbitrary I/O operations, but are terminating without raising exceptions.
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>
).
A head
element followed by the tail
of the list.
The empty list.
Append two lists.
Get (zero-based) element n
of a list. Return a maybestd/core/types/maybe: V -> V
type.
Do all elements satisfy a predicate ?
Are there any elements in a list that satisfy a predicate ?
Append two lists.
Concatenate all lists in a list (e.g. flatten the list). (tail-recursive).
Concatenate a list of maybestd/core/types/maybe: V -> V
values.
Drop the first n
elements of a list (or fewer if the list is shorter than n
).
Drop all initial elements that satisfy predicate
.
Retain only those elements of a list that satisfy the given predicate pred
.
For example: filterstd/core/filter: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e list<a>([1,2,3],odd?) == [1,3]
.
Retain only those elements of a list that satisfy the given predicate pred
.
For example: filterMap([1,2,3],fn(i) { if i.odd? then Nothingstd/core/types/Nothing: forall<a> maybe<a> else Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(i*i) }) == [4]
.
Find the first element satisfying some predicate.
Find the first element satisfying some predicate and return it.
Concatenate the result lists from applying a function to all elements.
Concatenate the Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
result elements from applying a function to all elements.
Fold a list from the left, i.e. foldlstd/core/foldl: forall<a,b,e> (list<a>, b, (b, a) -> e b) -> e b([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
.
Fold a list from the right, i.e. foldrstd/core/foldr: forall<a,b,e> (xs : list<a>, z : b, f : (a, b) -> e b) -> e b([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.
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/types/Nothing: forall<a> maybe<a>
.
Return the head of list if the list is not empty.
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
.
Automatically generated. Tests for the Consstd/core/Cons: forall<a> (head : a, tail : list<a>) -> list<a>
constructor of the liststd/core/list: V -> V
type.
Is the list empty?
Automatically generated. Tests for the Nilstd/core/Nil: forall<a> list<a>
constructor of the liststd/core/list: V -> V
type.
Append end
to each string in the list xs
and join them all together.
join-endstd/core/join-end: (xs : list<string>, end : string) -> string([],end) === ""
join-endstd/core/join-end: (xs : list<string>, end : string) -> string(["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/types/Nothing: forall<a> maybe<a>
for the empty list).
Return the last element of a list (or default
for the empty list).
Returns the length of a list.
Split a string into a list of lines.
Returns an integer list of increasing elements from lo
to hi
(including both lo
and hi
).
If lo > hi
the function returns the empty list.
Returns an integer list of increasing elements from lo
to hi
with stride stride
.
If lo > hi
the function returns the empty list.
Applies a function f
to list of increasing elements from lo
to hi
(including both lo
and hi
).
If lo > hi
the function returns the empty list.
Returns an integer list of increasing elements from lo
to hi
with stride stride
.
If lo > hi
the function returns the empty list.
Create a list of characters from lo
to hi
(inclusive).
Convert a maybestd/core/types/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.
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.
Apply a function f
to each element of the input list in sequence where f
takes
both the current element and the tail list as arguments.
Invoke action
on each element of a list while action
returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
.
Apply a function f
to each element of the input list in sequence.
Returns the largest element of a list of integers (or default
(=0
) for the empty list).
Returns the largest element of a list of floats (or 0
for the empty list).
Convert a list to a maybestd/core/types/maybe: V -> V
type, using Nothingstd/core/types/Nothing: forall<a> maybe<a>
for an empty list, and otherwise Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
on the head element.
Note: this is just head
.
Returns the smallest element of a list of integers (or default
(=0
) for the empty list).
Returns the smallest element of a list of floats (or 0
for the empty list).
Partition a list in two lists where the first list contains
those elements that satisfy the given predicate pred
.
For example: partitionstd/core/partition: forall<a,e> (xs : list<a>, pred : (a) -> e bool) -> e (list<a>, list<a>)([1,2,3],odd?) == ([1,3],[2])
.
Remove those elements of a list that satisfy the given predicate pred
.
For example: removestd/core/remove: forall<a> (xs : list<a>, pred : (a) -> bool) -> list<a>([1,2,3],odd?) == [2]
.
Create a list of n
repeated elementes x
.
Reverse a list.
Efficiently reverse a list xs
and append it to tl
:
reverse-appendstd/core/reverse-append: forall<a> (xs : list<a>, tl : list<a>) -> list<a>(xs,tl) == reserve(xs) ++ tl
.
Concatenate all strings in a list in reverse order.
Convert a list to a string.
Returns a singleton list.
split a list at position n
.
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"]
.
Convert a list of characters to a string.
Return the sum of a list of integers.
Return the tail of list. Returns the empty list if xs
is empty.
Take the first n
elements of a list (or fewer if the list is shorter than n
).
Keep only those initial elements that satisfy predicate
.
Join a list of strings with newlines.
Unzip a list of pairs into two lists.
Convert a list to a vector.
Convert a vector to a list with an optional tail.
Zip two lists together by pairing the corresponding elements. The returned list is only as long as the smallest input list.
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 netstd/core/net: X
effect signifies a function may access the network.
The named
effect is the default umbrella effect for named effects.
Abstract type used for passing null
values to external functions.
Transform a nullstd/core/null: V -> V
type to a maybestd/core/types/maybe: V -> V
type. Note that it is not
always the case that idstd/core/types/id: forall<a> (x : a) -> a(x) == maybe(null(x))
(e.g. when x = Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(Nothingstd/core/types/Nothing: forall<a> maybe<a>)
).
Transform a maybestd/core/types/maybe: V -> V
type to a nullstd/core/null: V -> V
type (using null
for Nothingstd/core/types/Nothing: forall<a> maybe<a>
).
Cast a integer that is zero to a null.
Cast an empty string a null.
Cast a boolean Falsestd/core/types/False: bool
to null.
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.
A sslicestd/core/sslice: V
represents a sub-slice of string and
has a specific start position and character count. It is used
instead of string indices to make the actual internal representation
of strings abstract (like UTF-8 or UTF-16). String slices are
returned by functions that find sub strings or patterns in
in strings. Use stringstd/core/string: (slice : sslice) -> string
to
create a fresh substring from a slice.
O(count
). Advance the start position of a string slice by count
characters
up to the end of the string.
A negative count
advances the start position backwards upto the first position
in a string.
Maintains the character count of the original slice upto the end of the string.
For example:
"abc".firststd/core/first: (s : string, n : ?int) -> sslice.advancestd/core/advance: (slice : sslice, count : int) -> sslice(1).string == "b"
,
"abc".firststd/core/first: (s : string, n : ?int) -> sslice.advancestd/core/advance: (slice : sslice, count : int) -> sslice(3).string == ""
,
* "abc".last.advancestd/core/advance: (slice : sslice, count : int) -> sslice(-1).string == "b"
.
O(1). Return the string slice from the end of slicestd/core/slice: (s : string) -> sslice
argument
to the end of the string.
O(1). Return the string slice from the start of a string up to the
start of slicestd/core/slice: (s : string) -> sslice
argument.
Return the common prefix of two strings (upto upto
characters (default is minimum length of the two strings)).
O(n). Return the number of characters in a string slice.
O(count
). Extend a string slice by count
characters up to the end of the string.
A negative count
shrinks the slice up to the empty slice.
For example:
"abc".firststd/core/first: (s : string, n : ?int) -> sslice.extendstd/core/extend: (slice : sslice, count : int) -> sslice(1).string == "ab"
"abc".last.extendstd/core/extend: (slice : sslice, count : int) -> sslice(-1).string == ""
.
O(n
). The first n
(default = 1
) characters in a string.
Apply a function for each character in a string slice.
If action
returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
, the function returns immediately with that result.
Apply a function for each character in a string slice.
Is a slice empty?
Is a slice not empty?
Is a slice invalid?
O(n
). The last n
(default = 1
) characters in a string.
If the slice is not empty, return the first character, and a new slice that is advanced by 1.
Show an sslicestd/core/sslice: V
as a string literal.
O(1). The entire string as a slice.
O(n). Copy the slicestd/core/slice: (s : string) -> sslice
argument into a fresh string.
Takes O(1) time if the slice covers the entire string.
A streamstd/core/stream: V -> V
is a co-inductive type representing an infinite list of elements.
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.
An alias for the empty effect.
The uistd/core/ui: X
effect signifies a function may access the graphics system.
Internal: used for value effects TODO: revisit value effects codegen.
Are two integers not equal?
Are two strings 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.
Append two strings.
Add two character code points.
Add two integers.
Substract two character codePoints.
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?
Are two strings equal? Uses exact equality between character codes.
Is the first integer greater than the second?
Is the first integer greater or equal to the second?
Return the element at position index
in vector v
. Raise an out of bounds exception if index < 0
or index >= v.length
.
Assign to an entry in a local vectorstd/core/types/vector: V -> V
variable.
Returns the value f
raised to the power p
.
Raise an integer i
to the power of exp
.
Choose a non-empty string.
Negate an integer.
Negate a float64std/core/types/float64: V
.
Return the absolute value of an integer.
Return the absolute value of a float64std/core/types/float64: V
f
.
Apply a function f
to a specified argument x
.
Return the element at position index
in vector v
, or Nothingstd/core/types/Nothing: forall<a> maybe<a>
if out of bounds.
Convert an int to a boolean, using Falsestd/core/types/False: bool
for 0 and Truestd/core/types/True: bool
otherwise.
Convert a maybestd/core/types/maybe: V -> V
type to a boolean using Falsestd/core/types/False: bool
for Nothingstd/core/types/Nothing: forall<a> maybe<a>
and Truestd/core/types/True: bool
for Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
.
Convert a string to a boolean, using Falsestd/core/types/False: bool
for the empty string and Truestd/core/types/True: bool
otherwise.
Convert the first character of a string to uppercase.
Deprecated; use try
instead. Catch an exception raised by throwstd/core/throw: forall<a> (message : string, info : ?exception-info) -> exn a
and handle it.
Use on-exn
or on-exitstd/core/on-exit: forall<a,e> (hndler : () -> e (), action : () -> e a) -> e a
when appropiate.
Convert a unicode code point to a character.
Compare two integers.
Compare two strings. Uses the character codes directly for comparison.
The const
funs returns its first argument and ignores the second.
Return a ‘constant’ function that ignores its argument and always returns the same result.
Does string s
contain the string sub
?
Count occurences of pattern
in a string.
Return the number of decimal digits of i
. Return 0
when i==0
.
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.
Convert a maybestd/core/types/maybe: V -> V<a>
value to a
, using the nothing
parameter for Nothingstd/core/types/Nothing: forall<a> maybe<a>
.
Euclidean-0 division & modulus.
Euclidean division is defined as: For any D
and d
where d!=0
, we have:
1. D == d*(D/d) + (D%d)
2. D%d
is always positive where 0 <= D%d < abs(d)
Moreover, Euclidean-0 is a total function, for the case where d==0
we have
that D%0 == D
and D/0 == 0
. So property (1) still holds, but not property (2).
Useful laws that hold for Euclidean-0 division:
D/(-d) == -(D/d)
D%(-d) == D%d
D/(2^n) == sar(D,n)
(with 0 <= n <= 31
and 2^n
means 2
to the power of n
)
D%(2n) == D & ((2n) - 1)
(with 0 <= n <= 31
and 2^n
means 2
to the power of n
)
See also Division and modulus for computer scientists, Daan Leijen, 2001 for further information
available at: http://research.microsoft.com/pubs/151917/divmodnote.pdf .
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 a pattern match exception. This is function is used internally by the compiler to generate error messages on pattern match failures.
Calculate 10^exp
.
Calculate 2^exp
.
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
.
Convert an integer to a float32std/core/types/float32: V
. May return nan
if the integer is too large to represent as a float32std/core/types/float32: V
.
Convert an integer to a float64std/core/types/float64: V
. May return nan
if the integer is too large to represent as a float64std/core/types/float64: V
.
fold over the integers between [startstd/core/start: (sslice : sslice) -> ssize_t
,end
] (inclusive).
fold over the integers between [0,upto
) (not including upto
).
Executes action
for each integer between startstd/core/start: (sslice : sslice) -> ssize_t
upto end
(including both startstd/core/start: (sslice : sslice) -> ssize_t
and end
).
If startstd/core/start: (sslice : sslice) -> ssize_t > end
the function returns without any call to action
.
Executes action
for each integer between startstd/core/start: (sslice : sslice) -> ssize_t
upto end
(including both startstd/core/start: (sslice : sslice) -> ssize_t
and end
).
If startstd/core/start: (sslice : sslice) -> ssize_t > end
the function returns without any call to action
.
If action
returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
, the iteration is stopped and the result returned.
Invoke a function f
for each element in a vector v
.
Invoke a function for each character in a string.
If action
returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
, the function returns immediately with that result.
Invoke a function f
for each element in a vector v
.
If f
returns Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
, the iteration is stopped early and the result is returned.
Invoke a function for each character in a string.
Invoke a function f
for each element in a vector v
.
Return the first character of a string (or Nothingstd/core/types/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
, node
, or libc
.
Convenient shorthand to int32std/core/int32: (i : int) -> int32
, e.g. 1234.i32std/core/i32: (i : int) -> int32
.
Convenient shorthand to int64std/core/int64: (i : int) -> int64
, e.g. 1234.i64std/core/i64: (i : int) -> int64
.
The ignorestd/core/ignore: forall<a> (x : a) -> ()
function ignores its argument.
Add the state effect to a function effect.
Convert a character to its unicode code point.
Convert an int32std/core/types/int32: V
to an intstd/core/types/int: V
.
Convert an ssize_tstd/core/types/ssize_t: V
to an intstd/core/types/int: V
.
Convert an int8std/core/types/int8: V
to an intstd/core/types/int: V
.
Convert an int16std/core/types/int16: V
to an intstd/core/types/int: V
.
Convert an int64_t
to an intstd/core/types/int: V
.
Convert an intptr_tstd/core/types/intptr_t: V
to an intstd/core/types/int: V
.
convert a float64std/core/types/float64: V
to an intstd/core/types/int: V
using round
to round to its nearest integer.
(rounding to an even number on a tie)
Returns 0
if the argument is not finite?
.
clamp an intstd/core/types/int: V
to fit in an int16std/core/types/int16: V
.
Convert an integer to an int32std/core/types/int32: V
. The number is clamped to the maximal or minimum int32std/core/types/int32: V
value if it is outside the range of an int32std/core/types/int32: V
.
clamp an intstd/core/types/int: V
to fit in an int64_t
.
clamp an intstd/core/types/int: V
to fit in an int8std/core/types/int8: V
.
clamp an intstd/core/types/int: V
to fit in an intptr_tstd/core/types/intptr_t: V
.
Is the character an ASCII letter is-.
Is the character ASCII letter or digit?
Is the character an ASCII character, e.g. c <= '\DEL'
?
Is the character an ASCII control character, e.g. c < ' '
?
Is the character an ASCII digit ?
Is a string empty?
Is this an even integer?
Return the number of ending 0
digits of i
. Return 0
when i==0
.
Is the character an ASCII hexa-decimal digit ?
Is the character a lower-case ASCII character ?
Is the integer negative (stricly smaller than zero).
Is the value negative?
Is a string not empty?
Is this an odd integer?
Is the integer positive (stricly greater than zero).
Is the value positive?
Is the character an upper-case ASCII character ?
Tests if a character is an element of " \t\n\r"
.
Is this equal to zero?
Is the value zero?
Concatenate a vector of strings.
Concatenate a vector of strings with a separator sep
.
Return the length of a vector.
Used by the compiler to wrap main console applications.
Map over the Rightstd/core/types/Right: forall<a,b> (right : b) -> either<a,b>
component of an eitherstd/core/types/either: (V, V) -> V
type.
Apply a function f
to each character in a string.
Apply a total function f
to each element in a vector v
.
Return the maximum of two integers.
Returns the largest of two floats.
Match a maybestd/core/types/maybe: V -> V
value and either return a default value on Nothingstd/core/types/Nothing: forall<a> maybe<a>
or apply a function to the value on Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
.
Convert a maybestd/core/types/maybe: V -> V<a>
value to a
, using the nothing
parameter for Nothingstd/core/types/Nothing: forall<a> maybe<a>
.
This is an alias for default
.
Convert a eitherstd/core/types/either: (V, V) -> V
to a maybestd/core/types/maybe: V -> V
type discarding the value of the Leftstd/core/types/Left: forall<a,b> (left : a) -> either<a,b>
constructor
and using Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
for the Rightstd/core/types/Right: forall<a,b> (right : b) -> either<a,b>
constructor.
Transform a boolean to a maybe type, using Nothingstd/core/types/Nothing: forall<a> maybe<a>
for Falsestd/core/types/False: bool
.
Transform an integer to a maybe type, using Nothingstd/core/types/Nothing: forall<a> maybe<a>
for 0
.
Transform a string to a maybe type, using Nothingstd/core/types/Nothing: forall<a> maybe<a>
for an empty string.
Return the minimum of two integers.
Returns the smallest of two floats.
Compose two funs f
and g
.
Set a hndler
that is always called when the action
finishes (either normally or with an exception).
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.
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/types/Nothing: forall<a> maybe<a>
is returned.
An empty string will result in Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>(0)
.
A string can start with a -
sign for negative numbers,
and with 0x
or 0X
for hexadecimal numbers (in which case the hex
parameter is ignored).
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
.
Internal: used for value effects TODO: revisit value effects codegen.
Raise an integer i
to the power of exp
.
Print a string to the console.
Print an integer to the console.
Print a float64 to the console.
Print a boolean to the console.
Print a character to the console.
Print a unit value to the console.
Print a string to the console, including a final newline character.
Print an integer to the console, including a final newline character.
Print a float64 to the console, including a final newline character.
Print a boolean to the console, including a final newline character.
Print a character to the console, including a final newline character.
Print a unit value to the console, including a final newline character.
Repeat a string n
times.
The repeat
fun executes action
n
times.
Replace every occurrence of pattern
to repl
in a string.
Convert an intstd/core/types/int: V
to a string.
Show a float64std/core/types/float64: V
in exponential (scientific) notation.
The optional precision
(= -17
) specifies the precision.
If >=0
it specifies the number of digits behind the dot (up to 17
max).
If negative, then at most the absolute value of precision
digits behind the dot are used.
Show a float64std/core/types/float64: V
fixed-point notation.
The optional precision
(= -2
) specifies the maximum precision.
If >=0
it specifies the number of digits behind the dot (up to 20
max).
If negative, then at most the absolute value of precision
digits behind the dot are used.
This may still show a number in exponential notation if the it is too small or large,
in particular, for a d
where d > 1.0e21
or d < 1.0e-15
, or if
precision.abs > 17
, the show-expstd/core/show-exp: (d : float64, precision : ?int) -> string
routine is used.
Show an intstd/core/types/int: V
as a hexadecimal value.
The width
parameter specifies how wide the hex value is where "0"
is used to align.
The use-capitals
parameter (= Truestd/core/types/True: bool
) determines if captical letters should be used to display the hexadecimal digits.
The pre
(="0x"
) is an optional prefix for the number (goes between the sign and the number).
Show a float64std/core/types/float64: V
as a string.
If d >= 1.0e-5
and d < 1.0e+21
, show-fixedstd/core/show-fixed: (d : float64, precision : ?int) -> string
is used and otherwise show-expstd/core/show-exp: (d : float64, precision : ?int) -> string
.
Default precision
is -17
.
Show a charstd/core/types/char: V
as a character literal.
Show a string as a string literal.
Convert a boolstd/core/types/bool: V
to a string.
Convert a unit value ()
to a string.
Convert an integer to an ssize_tstd/core/types/ssize_t: V
. The number is clamped to the maximal or minimum ssize_tstd/core/types/ssize_t: V
value if it is outside the range of an ssize_tstd/core/types/ssize_t: V
.
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 maybestd/core/types/maybe: V -> V
string to a string using the empty sting for Nothingstd/core/types/Nothing: forall<a> maybe<a>
.
Return the tail of a string (or the empty string).
Throw an exception with a specified message.
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
while s
starts with that string.
Trim the ending white space of a string.
Trim off a substring sub
while s
ends with that string.
Truncate a string to count
characters.
Catch any exception raised in action
and handle it.
Use on-exn
or on-exitstd/core/on-exit: forall<a,e> (hndler : () -> e (), action : () -> e a) -> e a
when appropiate.
Return a default value when an exception is raised.
Convert an int8std/core/types/int8: V
to an intstd/core/types/int: V
but interpret the int8std/core/types/int8: V
as an unsigned 8-bit value between 0 and 255.
clamp an intstd/core/types/int: V
to fit in an int8std/core/types/int8: V
but interpret the intstd/core/types/int: V
as an unsigned 8-bit value,
and clamp between 0 and 255.
Returns a unique integer (modulo 32-bits).
Get the value of the Juststd/core/types/Just: forall<a> (value : a) -> maybe<a>
constructor or raise an exception.
Unsafe. This function removes the exception effect (exnstd/core/exn: HX
) from the effect of an action.
Unsafe. This function removes the non-termination effect (divstd/core/types/div: X
) from the effect of an action.
Create an empty vector.
Create a new vector of length n
with initial elements given by function f
.
Convert a string to a vector of characters.
Create a new vector of length n
with initial elements default
.
The whilestd/core/while: forall<e> (predicate : () -> <div|e> bool, action : () -> <div|e> ()) -> <div|e> ()
fun executes action
as long as pred
is true
.
Core functions.
This module is implicitly imported and all functions and types are always available. Some types and operations are required to be defined for the compiler to work correctly (i.e. types like
exnstd/core/exn: HX
orliststd/core/list: V -> V
).