# Prelude

## Type Aliases

`type alias Static = IO`

Static denotes the region of global lifetime.

## Definitions

`def !>(x: a, f: a -> Unit \ ef): a \ ef`

Pipes the given value `x` into the function `f`.

Given a value `x` and a function `f` returns `x`.

`def ++(x: a, y: a): a with SemiGroup[a]`

Alias for `SemiGroup.combine`.

`def >>(f: a -> b \ ef1, g: b -> c \ ef2): a -> c \ ef1 + ef2`

Forwards function composition. Applies the function on the left first.

Given the functions `f: a -> b` and `g: b -> c` returns a function `a -> c`

`def bug!(m: String): a`

Crashes the current process with the given message `m`.

`def coerce(x: t): Out[t] with Coerce[t]`

Coerces the given value `x`.

`def constant(x: a): b -> a \ ef`

The constant function.

`def eidentity(x: a): a \ ef`

The identity function, automatically casting to the required effect.

`def flip(f: a -> (b -> c \ ef)): b -> (a -> c \ ef)`

Returns the function `f` with input arguments swapped. That is, given the function `f: (a, b) -> c`, returns a function `(b, a) -> c`

`def fst(p: (a, b)): a`

Returns the first component of `t`.

`def identity(x: a): a`

The pure identity function.

`def on(f: b -> (b -> c \ ef1), g: a -> b \ ef2, x: a, y: a): c \ ef1 + ef2`

Partially applying this function in the form `f `on` g` lifts the binary function `f` to work on inputs transformed by `g`.

`def println(x: a): Unit \ IO with ToString[a]`

Converts `x` to a string and prints it to standard out followed by a new line.

`def purityOf(f: a -> b \ ef): Purity[a, b, ef]`

Returns `Purity.Pure(g)` if `f` has no effects. Returns `Purity.Impure(g)` otherwise. The function `g` can then be used in a context that requires it to be pure.

`def purityOf2(f: a -> (b -> c \ ef)): Purity2[a, b, c, ef]`

Returns `Purity2.Pure(g)` if `f` has no effects. Returns `Purity2.Impure(g)` otherwise. The function `g` can then be used in a context that requires it to be pure.

`def purityOf3(f: a -> (b -> (c -> d \ ef))): Purity3[a, b, c, d, ef]`

Returns `Purity3.Pure(g)` if `f` has no effects. Returns `Purity3.Impure(g)` otherwise. The function `g` can then be used in a context that requires it to be pure.

`def snd(p: (a, b)): b`

Returns the second component of `t`.

`def swap(p: (a, b)): (b, a)`

Returns the pair `p` with the components swapped. That is, returns `(y, x)` if `p = (x, y)`.

`def touch(_: Region[r]): Unit \ r`

Touches the given region capability `rc`.

`def unreachable!(): a`

Asserts that this expression is unreachable. Crashes if not.

`def |+|(x: a, y: a): a with CommutativeSemiGroup[a]`

Alias for `CommutativeSemiGroup.combine`.

`def |>(x: a, f: a -> b \ ef): b \ ef`

Pipes the given value `x` into the function `f`.

Given a value `x` and a function `f` returns `f(x)`.

`def ||>(x: (a, b), f: a -> (b -> c \ ef)): c \ ef`

Pipes the given pair `x` into the function `f`.

Given a pair `x` and a function `f` returns `f(x)`.