# Prelude

Summary
 Prelude Types maybe The maybe type encapsulates an optional value. Functions just nothing Types either The either type represents values with two possibilities. Functions left right Types list The list record type represents an ordered series of elements of a given length. sig The signal type encapsulates the concept of a signal. Functions signal compose Composes two functions together. curry Curries a function with an argument arity of 2. uncurrcy Uncurries a function with an argument arity of 2. curry3 Curries a function with an argument arity of 3. uncurry3 Uncurries a function with an argument arity of 3. eq A function representation of the equality operator neq A function representation of the inequality operator gt A function representation of the greater than operator geq A function representation of the greater than or equal operator lt A function representation of the less than operator leq A function representation of the less than or equal operator notf A function representation of the not operator andf A function representation of the and operator orf A function representation of the or operator apply2 Applies a tuple of values to the given function apply3 Applies a tuple of values to the given function apply4 Applies a tuple of values to the given function fst Gives the first element of a two element tuple. snd Gives the second element of a two element tuple. add Adds the two arguments together. mul Subtracts the two arguments mul Multiplies the two arguments together. div Divides one number by the other. swap Swaps the two elements of a tuple

### 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>`

### just

#### Type Signature

`<'a>('a) -> maybe<'a>`

### nothing

#### Type signature

`<'a>('a) -> maybe<'a>`

### 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>`

### left

#### Type signature

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

### right

#### Type signature

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

### 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 : uint32 The 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>`

### 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) -> ‘c The second function to compose g : (‘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>(('a, 'b) -> 'c) -> (('a) -> ('b) -> 'c)`

#### Parameters

 f : (‘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>(('a) -> ('b) -> 'c) -> (('a, 'b) -> 'c)`

#### Parameters

 f : (‘a) -> (‘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>(('a, 'b, 'c) -> 'd) -> (('a) -> ('b) -> ('c) -> 'd)`

#### Parameters

 f : (‘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>(('a) -> ('b) -> ('c) -> 'd) -> (('a, 'b, 'c) -> 'd)`

#### Parameters

 f : (‘a) -> (‘b) -> (‘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>('a, 'a) -> bool`

#### 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>('a, 'a) -> bool`

#### 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>('a, 'a) -> bool`

#### 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>('a, 'a) -> bool`

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

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

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) -> ‘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>(('a,'b,'c) -> 'd, 'a*'b*'c) -> 'd`

#### Parameters

 f : (‘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>(('a,'b,'c,'d) -> 'e, 'a*'b*'c*'d) -> 'e`

#### Parameters

 f : (‘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.

#### Type signature

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

#### Parameters

 numA : ‘a The first number numB : ‘a The second number

#### Returns

The sum of the two numbers

### mul

Subtracts the two arguments

#### Type signature

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

#### 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`

#### 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`

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