Prelude
Types
maybe

The maybe type encapsulates an optional value. A value of type maybe<'a> either contains a value of type 'a (represented as just<'a>), or it is empty (represented as nothing<'a>).

maybe<'a>
Constructors
Functions
just
Type Signature
<'a>(||)('a) -> maybe<'a>
nothing

Type signature:

<'a>(||)() -> maybe<'a>
Types
either

The either type represents values with two possibilities. A value of type A value of type either<'a,'b> is either left a or right b.

either<'a,'b>
Constructors
Functions
left

Type signature:

<'a,'b>('a) -> either<'a,'b>
right

Type signature:

<'a,'b>(||)('b) -> either<'a, 'b>
Types
alias list

The list record type represents an ordered series of elements of a given length.

alias list<'a; n> = { data : 'a[n]; length : uint32 }
Members
data : 'a[n]

The internal array used to store the elements.

length : uint32

The length of the list

alias charlist

The charlist alias represents a list of extended ASCII characters at most length n (this does not include the final null byte). To get the length of the string not including the null byte, use CharList:length.

alias charlist<;n> = list<uint8;n+1>
Members

data : uint8[n+1] length : uint32

sig

The signal type encapsulates the concept of a signal. At any point in time, a signal may having nothing travelling through it, or something travelling through it.

sig<'a>
Constructors
Functions
signal

Type signature:

(||)(maybe<'a>) -> sig<'a>
extractptr

Extracts the contained rawpointer from a pointer.

Type signature:

(||)(pointer) -> rawpointer
Parameters
p : pointer

The pointer to extract the rawpointer from

Returns

The extracted rawpointer

compose

Composes two functions together.

Type signature:

<'a,'b,'c,'closureF,'closureG>(||)(('closureF)('b) -> 'c, ('closureG)('a) -> 'b) -> ((|f : ('closureF)('b) -> 'c; g : ('closureG)('a) -> 'b|)('a) -> 'c)
Parameters
f : ('closureF)('b) -> 'c

The second function to compose

g : ('closureG)('a) -> 'b

The first function to compose

Returns

A composed function equivalent to f(g(x))

curry

Curries a function with an argument arity of 2.

Type signature:

<'a,'b,'c,'closure>(||)(('closure)('a, 'b) -> 'c) -> ((|f : ('closure)('a, 'b) -> 'c|)('a) -> (|valueA : 'a; f : ('closure)('a, 'b) -> 'c|)('b) -> 'c)
Parameters
f : ('closure)('a, 'b) -> 'c

The function to curry.

Returns

A curried function

uncurrcy

Uncurries a function with an argument arity of 2.

Type signature:

<'a,'b,'c,'closureA,'closureB>(||)(('closureA)('a) -> ('closureB)('b) -> 'c) -> ((|f : ('closureA)('a) -> ('closureB)('b) -> 'c|)('a, 'b) -> 'c)
Parameters
f : ('closureA)('a) -> ('closureB)('b) -> 'c

The function to uncurry.

Returns

A uncurried function

curry3

Curries a function with an argument arity of 3.

Type signature:

<'a,'b,'c,'d,'closureF>(||)(('closureF)('a, 'b, 'c) -> 'd) -> ((|f : ('closureF)('a, 'b, 'c) -> 'd|)('a) -> (|f : ('closureF)('a, 'b, 'c) -> 'd; valueA : 'a|)('b) -> (|f : ('closureF)('a, 'b, 'c) -> 'd; valueA : 'a; valueB : 'b|)('c) -> 'd)
Parameters
f : ('closureF)('a, 'b, 'c) -> 'd

The function to curry.

Returns

A curried function

uncurry3

Uncurries a function with an argument arity of 3.

Type signature:

<'a,'b,'c,'d,'closureA,'closureB,'closureC>(||)(('closureA)('a) -> ('closureB)('b) -> ('closureC)('c) -> 'd) -> ((|f : ('closureA)('a) -> ('closureB)('b) -> ('closureC)('c) -> 'd|)('a, 'b, 'c) -> 'd)
Parameters
f : ('closureA)('a) -> ('closureB)('b) -> ('closureC)('c) -> 'd

The function to uncurry

Returns

An uncurried function

eq

A function representation of the equality operator

Type signature:

<'a>(||)('a, 'a) -> bool
Parameters
x : 'a

The first value to compare

y : 'b

The second value to compare

Returns

True if the values are equivalent, false otherwise.

neq

A function representation of the inequality operator

Type signature:

<'a>(||)('a, 'a) -> bool
Parameters
x : 'a

The first value to compare

y : 'b

The second value to compare

Returns

False if the values are equivalent, true otherwise.

gt

A function representation of the greater than operator

Type signature:

<'a, 'b>(||)('a, 'b) -> bool where 'a : num, 'b : num
Parameters
x : 'a

The first value to compare

y : 'b

The second value to compare

Returns

True if x > y, false otherwise.

geq

A function representation of the greater than or equal operator

Type signature:

<'a, 'b>(||)('a, 'b) -> bool where 'a : num, 'b : num
Parameters
x : 'a

The first value to compare

y : 'b

The second value to compare

Returns

True if x >= y, false otherwise.

lt

A function representation of the less than operator

Type signature:

<'a, 'b>(||)('a, 'b) -> bool where 'a : num, 'b : num
Parameters
x : 'a

The first value to compare

y : 'b

The second value to compare

Returns

True if x < y, false otherwise.

leq

A function representation of the less than or equal operator

Type signature:

<'a, 'b>(||)('a, 'b) -> bool where 'a : num, 'b : num
Parameters
x : 'a

The first value to compare

y : 'b

The second value to compare

Returns

True if x <= y, false otherwise.

notf

A function representation of the not operator

Type signature:

(||)(bool) -> bool
Parameters
x : bool

The value to take the logical inverse of

Returns

The logical inverse of x

andf

A function representation of the and operator

Type signature:

(||)(bool, bool) -> bool
Parameters
x : bool

The first boolean value

y : bool

The second boolean value

Returns

x and y

orf

A function representation of the or operator

Type signature:

(||)(bool, bool) -> bool
Parameters
x : bool

The first boolean value

y : bool

The second boolean value

Returns

x or y

apply2

Applies a tuple of values to the given function

Type signature:

<'a,'b,'c,'closure>(||)(('closure)('a,'b) -> 'c, 'a*'b) -> 'c
Parameters
f : ('closure)('a,'b) -> 'c

The function to apply

tup : 'a*'b

The values to pass to the function

Returns

The result of the values held in the tuple applied to f

apply3

Applies a tuple of values to the given function

Type signature:

<'a,'b,'c,'d,'closure>(||)(('closure)('a,'b,'c) -> 'd, 'a*'b*'c) -> 'd
Parameters
f : ('closure)('a,'b,'c) -> 'd

The function to apply

tup : 'a*'b*'c

The values to pass to the function

Returns

The result of the values held in the tuple applied to f

apply4

Applies a tuple of values to the given function

Type signature:

<'a,'b,'c,'d,'e,'closure>(||)(('closure)('a,'b,'c,'d) -> 'e, 'a*'b*'c*'d) -> 'e
Parameters
f : ('closure)('a,'b,'c,'d) -> 'e

The function to apply

tup : 'a*'b*'c*'d

The values to pass to the function

Returns

The result of the values held in the tuple applied to f

fst

Gives the first element of a two element tuple.

Type signature:

<'a, 'b>(||)(('a * 'b)) -> 'a
Parameters
tup : ('a * 'b)

The tuple to extract the first element from

Returns

The first element of the two element tuple.

snd

Gives the second element of a two element tuple.

Type signature:

<'a, 'b>(||)(('a * 'b)) -> 'b
Parameters
tup : ('a * 'b)

The tuple to extract the second element from

Returns

The second element of the two element tuple.

add

Adds the two arguments together.

Type signature:

<'a>(||)('a, 'a) -> 'a where 'a : num
Parameters
numA : 'a

The first number

numB : 'a

The second number

Returns

The sum of the two numbers

sub

Subtracts the two arguments

Type signature:

<'a>(||)('a, 'a) -> 'a where 'a : num
Parameters
numA : 'a

The first number

numB : 'a

The second number

Returns

The difference of the two numbers

mul

Multiplies the two arguments together.

Type signature:

<'a>(||)('a, 'a) -> 'a where 'a : num
Parameters
numA : 'a

The first number

numB : 'a

The second number

Returns

The product of the two numbers

div

Divides one number by the other.

Type signature:

<'a>(||)('a, 'a) -> 'a where 'a : num
Parameters
numA : 'a

The numerator

numB : 'a

The denominator

Returns

The difference of the two numbers

swap

Swaps the two elements of a tuple

Type signature:

<'a,'b>(||)('a*'b) -> ('b*'a)
Parameters
tup : 'a*'b

The tuple to swap

Returns

The tuple with swapped elements

until

Yields the result of applying f until p holds.

Type signature:

<'a>(||)(('closureP)('a) -> bool, ('closureF)('a) -> 'a, 'a) -> 'a
Parameters
p: ('closureP)('a) -> bool

The predicate

f: ('closureF)('a) -> 'a

The function to repeatedly apply

a0: 'a

The initial value to supply to the function

ignore

Takes a value as a parameter and ignores it.

Type signature:

<'a>(||)('a) -> unit
u8ToU16

Converts a uint8 to a uint16.

Type signature:

(||)(uint8) ->uint16
Parameters
n : uint8

The number to convert

Returns

The number with converted type

u8ToU32

Converts a uint8 to a uint32.

Type signature:

(||)(uint8) ->uint32
Parameters
n : uint8

The number to convert

Returns

The number with converted type

u8ToI8

Converts a uint8 to a int8.

Type signature:

(||)(uint8) ->int8
Parameters
n : uint8

The number to convert

Returns

The number with converted type

u8ToI16

Converts a uint8 to a int16.

Type signature:

(||)(uint8) ->int16
Parameters
n : uint8

The number to convert

Returns

The number with converted type

u8ToI32

Converts a uint8 to a int32.

Type signature:

(||)(uint8) ->int32
Parameters
n : uint8

The number to convert

Returns

The number with converted type

u8ToFloat

Converts a uint8 to a float.

Type signature:

(||)(uint8) ->float
Parameters
n : uint8

The number to convert

Returns

The number with converted type

u8ToDouble

Converts a uint8 to a double.

Type signature:

(||)(uint8) ->double
Parameters
n : uint8

The number to convert

Returns

The number with converted type

u16ToU8

Converts a uint16 to a uint8.

Type signature:

(||)(uint16) ->uint8
Parameters
n : uint16

The number to convert

Returns

The number with converted type

u16ToU32

Converts a uint16 to a uint32.

Type signature:

(||)(uint16) ->uint32
Parameters
n : uint16

The number to convert

Returns

The number with converted type

u16ToI8

Converts a uint16 to a int8.

Type signature:

(||)(uint16) ->int8
Parameters
n : uint16

The number to convert

Returns

The number with converted type

u16ToI16

Converts a uint16 to a int16.

Type signature:

(||)(uint16) ->int16
Parameters
n : uint16

The number to convert

Returns

The number with converted type

u16ToI32

Converts a uint16 to a int32.

Type signature:

(||)(uint16) ->int32
Parameters
n : uint16

The number to convert

Returns

The number with converted type

u16ToFloat

Converts a uint16 to a float.

Type signature:

(||)(uint16) ->float
Parameters
n : uint16

The number to convert

Returns

The number with converted type

u16ToDouble

Converts a uint16 to a double.

Type signature:

(||)(uint16) ->double
Parameters
n : uint16

The number to convert

Returns

The number with converted type

u32ToU8

Converts a uint32 to a uint8.

Type signature:

(||)(uint32) ->uint8
Parameters
n : uint32

The number to convert

Returns

The number with converted type

u32ToU16

Converts a uint32 to a uint16.

Type signature:

(||)(uint32) ->uint16
Parameters
n : uint32

The number to convert

Returns

The number with converted type

u32ToI8

Converts a uint32 to a int8.

Type signature:

(||)(uint32) ->int8
Parameters
n : uint32

The number to convert

Returns

The number with converted type

u32ToI16

Converts a uint32 to a int16.

Type signature:

(||)(uint32) ->int16
Parameters
n : uint32

The number to convert

Returns

The number with converted type

u32ToI32

Converts a uint32 to a int32.

Type signature:

(||)(uint32) ->int32
Parameters
n : uint32

The number to convert

Returns

The number with converted type

u32ToFloat

Converts a uint32 to a float.

Type signature:

(||)(uint32) ->float
Parameters
n : uint32

The number to convert

Returns

The number with converted type

u32ToDouble

Converts a uint32 to a double.

Type signature:

(||)(uint32) ->double
Parameters
n : uint32

The number to convert

Returns

The number with converted type

i8ToU8

Converts a int8 to a uint8.

Type signature:

(||)(int8) ->uint8
Parameters
n : int8

The number to convert

Returns

The number with converted type

i8ToU16

Converts a int8 to a uint16.

Type signature:

(||)(int8) ->uint16
Parameters
n : int8

The number to convert

Returns

The number with converted type

i8ToU32

Converts a int8 to a uint32.

Type signature:

(||)(int8) ->uint32
Parameters
n : int8

The number to convert

Returns

The number with converted type

i8ToI16

Converts a int8 to a int16.

Type signature:

(||)(int8) ->int16
Parameters
n : int8

The number to convert

Returns

The number with converted type

i8ToI32

Converts a int8 to a int32.

Type signature:

(||)(int8) ->int32
Parameters
n : int8

The number to convert

Returns

The number with converted type

i8ToFloat

Converts a int8 to a float.

Type signature:

(||)(int8) ->float
Parameters
n : int8

The number to convert

Returns

The number with converted type

i8ToDouble

Converts a int8 to a double.

Type signature:

(||)(int8) ->double
Parameters
n : int8

The number to convert

Returns

The number with converted type

i16ToU8

Converts a int16 to a uint8.

Type signature:

(||)(int16) ->uint8
Parameters
n : int16

The number to convert

Returns

The number with converted type

i16ToU16

Converts a int16 to a uint16.

Type signature:

(||)(int16) ->uint16
Parameters
n : int16

The number to convert

Returns

The number with converted type

i16ToU32

Converts a int16 to a uint32.

Type signature:

(||)(int16) ->uint32
Parameters
n : int16

The number to convert

Returns

The number with converted type

i16ToI8

Converts a int16 to a int8.

Type signature:

(||)(int16) ->int8
Parameters
n : int16

The number to convert

Returns

The number with converted type

i16ToI32

Converts a int16 to a int32.

Type signature:

(||)(int16) ->int32
Parameters
n : int16

The number to convert

Returns

The number with converted type

i16ToFloat

Converts a int16 to a float.

Type signature:

(||)(int16) ->float
Parameters
n : int16

The number to convert

Returns

The number with converted type

i16ToDouble

Converts a int16 to a double.

Type signature:

(||)(int16) ->double
Parameters
n : int16

The number to convert

Returns

The number with converted type

i32ToU8

Converts a int32 to a uint8.

Type signature:

(||)(int32) ->uint8
Parameters
n : int32

The number to convert

Returns

The number with converted type

i32ToU16

Converts a int32 to a uint16.

Type signature:

(||)(int32) ->uint16
Parameters
n : int32

The number to convert

Returns

The number with converted type

i32ToU32

Converts a int32 to a uint32.

Type signature:

(||)(int32) ->uint32
Parameters
n : int32

The number to convert

Returns

The number with converted type

i32ToI8

Converts a int32 to a int8.

Type signature:

(||)(int32) ->int8
Parameters
n : int32

The number to convert

Returns

The number with converted type

i32ToI16

Converts a int32 to a int16.

Type signature:

(||)(int32) ->int16
Parameters
n : int32

The number to convert

Returns

The number with converted type

i32ToFloat

Converts a int32 to a float.

Type signature:

(||)(int32) ->float
Parameters
n : int32

The number to convert

Returns

The number with converted type

i32ToDouble

Converts a int32 to a double.

Type signature:

(||)(int32) ->double
Parameters
n : int32

The number to convert

Returns

The number with converted type

floatToU8

Converts a float to a uint8.

Type signature:

(||)(float) ->uint8
Parameters
n : float

The number to convert

Returns

The number with converted type

floatToU16

Converts a float to a uint16.

Type signature:

(||)(float) ->uint16
Parameters
n : float

The number to convert

Returns

The number with converted type

floatToU32

Converts a float to a uint32.

Type signature:

(||)(float) ->uint32
Parameters
n : float

The number to convert

Returns

The number with converted type

floatToI8

Converts a float to a int8.

Type signature:

(||)(float) -> int8
Parameters
n : float

The number to convert

Returns

The number with converted type

floatToI16

Converts a float to a int16.

Type signature:

(||)(float) -> int16
Parameters
n : float

The number to convert

Returns

The number with converted type

floatToI32

Converts a float to a int32.

Type signature:

(||)(float) ->int32
Parameters
n : float

The number to convert

Returns

The number with converted type

floatToDouble

Converts a float to a double.

Type signature:

(||)(float) ->double
Parameters
n : float

The number to convert

Returns

The number with converted type

doubleToU8

Converts a double to a uint8.

Type signature:

(||)(double) ->uint8
Parameters
n : double

The number to convert

Returns

The number with converted type

doubleToU16

Converts a double to a uint16.

Type signature:

(||)(double) -> uint16
Parameters
n : double

The number to convert

Returns

The number with converted type

doubleToU32

Converts a double to a uint32.

Type signature:

(||)(double) -> uint32
Parameters
n : double

The number to convert

Returns

The number with converted type

doubleToI8

Converts a double to a int8.

Type signature:

(||)(double) -> int8
Parameters
n : double

The number to convert

Returns

The number with converted type

doubleToI16

Converts a double to a int16.

Type signature:

(||)(double) -> int16
Parameters
n : double

The number to convert

Returns

The number with converted type

doubleToI32

Converts a double to a int32.

Type signature:

(||)(double) -> int32
Parameters
n : double

The number to convert

Returns

The number with converted type

doubleToFloat

Converts a double to a float.

Type signature:

(||)(double) -> float
Parameters
n : double

The number to convert

Returns

The number with converted type

toUInt8

Converts a number to a uint8.

Type signature:

<'t>(||)('t) -> uint8 where 't : num
Parameters
n : 't

The number to convert

Returns

The number with converted type

toInt8

Converts a number to a int8.

Type signature:

<'t>(||)('t) -> int8 where 't : num
Parameters
n : 't

The number to convert

Returns

The number with converted type

toUInt16

Converts a number to a uint16.

Type signature:

<'t>(||)('t) -> uint16 where 't : num
Parameters
n : 't

The number to convert

Returns

The number with converted type

toInt16

Converts a number to a uint16.

Type signature:

<'t>(||)('t) -> uint16 where 't : num
Parameters
n : 't

The number to convert

Returns

The number with converted type

toUInt32

Converts a number to a uint32.

Type signature:

<'t>(||)('t) -> uint32 where 't : num
Parameters
n : 't

The number to convert

Returns

The number with converted type

toInt32

Converts a number to a int32.

Type signature:

<'t>(||)('t) -> int32 where 't : num
Parameters
n : 't

The number to convert

Returns

The number with converted type

toFloat

Converts a number to a float.

Type signature:

<'t>(||)('t) -> float where 't : num
Parameters
n : 't

The number to convert

Returns

The number with converted type

toDouble

Converts a number to a double.

Type signature:

<'t>(||)('t) -> double where 't : num
Parameters
n : 't

The number to convert

Returns

The number with converted type

fromUInt8

Converts a uint8 to another number type.

Type signature:

<'t>(||)(uint8) -> 't where 't : num
Parameters
n : uint8

The number to convert

Returns

The number with converted type

fromInt8

Converts a int8 to another number type.

Type signature:

<'t>(||)(int8) -> 't where 't : num
Parameters
n : int8

The number to convert

Returns

The number with converted type

fromUInt16

Converts a uint16 to another number type.

Type signature:

<'t>(||)(uint16) -> 't where 't : num
Parameters
n : uint16

The number to convert

Returns

The number with converted type

fromInt16

Converts a int16 to another number type.

Type signature:

<'t>(||)(int16) -> 't where 't : num
Parameters
n : int16

The number to convert

Returns

The number with converted type

fromUInt32

Converts a uint32 to another number type.

Type signature:

<'t>(||)(uint32) -> 't where 't : num
Parameters
n : uint32

The number to convert

Returns

The number with converted type

fromInt32

Converts a int32 to another number type.

Type signature:

<'t>(||)(int32) -> 't where 't : num
Parameters
n : int32

The number to convert

Returns

The number with converted type

fromFloat

Converts a float to another number type.

Type signature:

<'t>(||)(float) -> 't where 't : num
Parameters
n : float

The number to convert

Returns

The number with converted type

fromDouble

Converts a double to another number type.

Type signature:

<'t>(||)(double) -> 't where 't : num
Parameters
n : double

The number to convert

Returns

The number with converted type

cast

Converts a number of one type to a number of another type.

Type signature:

<'a, 'b>(||)('a) -> 'b where 'a : num, 'b : num
Parameters
x : 'a

The number to convert

Returns

The number with converted type