Prelude

Summary
Prelude
Types
maybeThe maybe type encapsulates an optional value.
Functions
just
nothing
Types
eitherThe either type represents values with two possibilities.
Functions
left
right
Types
listThe list record type represents an ordered series of elements of a given length.
sigThe signal type encapsulates the concept of a signal.
Functions
signal
composeComposes two functions together.
curryCurries a function with an argument arity of 2.
uncurrcyUncurries a function with an argument arity of 2.
curry3Curries a function with an argument arity of 3.
uncurry3Uncurries a function with an argument arity of 3.
eqA function representation of the equality operator
neqA function representation of the inequality operator
gtA function representation of the greater than operator
geqA function representation of the greater than or equal operator
ltA function representation of the less than operator
leqA function representation of the less than or equal operator
notfA function representation of the not operator
andfA function representation of the and operator
orfA function representation of the or operator
apply2Applies a tuple of values to the given function
apply3Applies a tuple of values to the given function
apply4Applies a tuple of values to the given function
fstGives the first element of a two element tuple.
sndGives the second element of a two element tuple.
addAdds the two arguments together.
mulSubtracts the two arguments
mulMultiplies the two arguments together.
divDivides one number by the other.
swapSwaps the two elements of a tuple

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>('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

list

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

list<'a; n>

Members

data : ‘a[n]The internal array used to store the elements.
length : uint32The length of the list

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>

compose

Composes two functions together.

Type signature

<'a,'b,'c>(('b) -> 'c, ('a) -> 'b) -> (('a) -> 'c)

Parameters

f : (‘b) -> ‘cThe second function to compose
g : (‘a) -> ‘bThe 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>(('a, 'b) -> 'c) -> (('a) -> ('b) -> 'c)

Parameters

f : (‘a, ‘b) -> ‘cThe function to curry.

Returns

A curried function

uncurrcy

Uncurries a function with an argument arity of 2.

Type signature

<'a,'b,'c>(('a) -> ('b) -> 'c) -> (('a, 'b) -> 'c)

Parameters

f : (‘a) -> (‘b) -> ‘cThe function to uncurry.

Returns

A uncurried function

curry3

Curries a function with an argument arity of 3.

Type signature

<'a,'b,'c,'d>(('a, 'b, 'c) -> 'd) -> (('a) -> ('b) -> ('c) -> 'd)

Parameters

f : (‘a, ‘b, ‘c) -> ‘dThe function to curry.

Returns

A curried function

uncurry3

Uncurries a function with an argument arity of 3.

Type signature

<'a,'b,'c,'d>(('a) -> ('b) -> ('c) -> 'd) -> (('a, 'b, 'c) -> 'd)

Parameters

f : (‘a) -> (‘b) -> (‘c) -> ‘dThe function to uncurry

Returns

An uncurried function

eq

A function representation of the equality operator

Type signature

<'a>('a, 'a) -> bool

Parameters

x : ‘aThe first value to compare
y : ‘bThe 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 : ‘aThe first value to compare
y : ‘bThe 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>('a, 'a) -> bool

Parameters

x : ‘aThe first value to compare
y : ‘bThe 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>('a, 'a) -> bool

Parameters

x : ‘aThe first value to compare
y : ‘bThe second value to compare

Returns

True if x >= y, false otherwise.

lt

A function representation of the less than operator

Type signature

<'a>('a, 'a) -> bool

Parameters

x : ‘aThe first value to compare
y : ‘bThe 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>('a, 'a) -> bool

Parameters

x : ‘aThe first value to compare
y : ‘bThe 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 : boolThe 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 : boolThe first boolean value
y : boolThe second boolean value

Returns

x and y

orf

A function representation of the or operator

Type signature

(bool, bool) -> bool

Parameters

x : boolThe first boolean value
y : boolThe second boolean value

Returns

x or y

apply2

Applies a tuple of values to the given function

Type signature

<'a,'b,'c>(('a,'b) -> 'c, 'a*'b) -> 'c

Parameters

f : (‘a,’b) -> ‘cThe function to apply
tup : ‘a*’bThe 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>(('a,'b,'c) -> 'd, 'a*'b*'c) -> 'd

Parameters

f : (‘a,’b,’c) -> ‘dThe function to apply
tup : ‘a*’b*’cThe 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>(('a,'b,'c,'d) -> 'e, 'a*'b*'c*'d) -> 'e

Parameters

f : (‘a,’b,’c,’d) -> ‘eThe function to apply
tup : ‘a*’b*’c*’dThe 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

Parameters

numA : ‘aThe first number
numB : ‘aThe second number

Returns

The sum of the two numbers

mul

Subtracts the two arguments

Type signature

<'a>('a, 'a) -> 'a

Parameters

numA : ‘aThe first number
numB : ‘aThe second number

Returns

The difference of the two numbers

mul

Multiplies the two arguments together.

Type signature

<'a>('a, 'a) -> 'a

Parameters

numA : ‘aThe first number
numB : ‘aThe second number

Returns

The product of the two numbers

div

Divides one number by the other.

Type signature

<'a>('a, 'a) -> 'a

Parameters

numA : ‘aThe numerator
numB : ‘aThe 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*’bThe tuple to swap

Returns

The tuple with swapped elements

Close