Prelude
Type Aliases
type alias FileIO = FileRead + FileWrite
SourceA type alias for the FileRead
and FileWrite
effects.
type alias Static = IO
SourceStatic denotes the region of global lifetime.
Definitions
def !>(x: a, f: a -> Unit \ ef): a \ ef
SourcePipes the given value x
into the function f
.
Given a value x
and a function f
returns x
.
def >>(f: a -> b \ ef1, g: b -> c \ ef2): a -> c \ ef1 + ef2
SourceForwards 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
SourceCrashes the current process with the given message m
.
def constant(x: a): b -> a \ ef
SourceThe constant function.
def eidentity(x: a): a \ ef
SourceThe identity function, automatically casting to the required effect.
def flip(f: a -> (b -> c \ ef)): b -> (a -> c \ ef)
SourceReturns 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
SourceReturns the first component of t
.
def identity(x: a): a
SourceThe pure identity function.
def on(f: b -> (b -> c \ ef1), g: a -> b \ ef2, x: a, y: a): c \ ef1 + ef2
SourcePartially applying this function in the form f `on` g
lifts the binary function f
to work on
inputs transformed by g
.
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]
SourceReturns 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]
SourceReturns 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]
SourceReturns 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
SourceReturns the second component of t
.
def swap(p: (a, b)): (b, a)
SourceReturns the pair p
with the components swapped.
That is, returns (y, x)
if p = (x, y)
.
def touch(_: Region[r]): Unit \ r
SourceTouches the given region capability rc
.
def unreachable!(): a
SourceAsserts that this expression is unreachable. Crashes if not.
def |+|(x: a, y: a): a with CommutativeSemiGroup[a]
SourceAlias for CommutativeSemiGroup.combine
.
def |>(x: a, f: a -> b \ ef): b \ ef
SourcePipes 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
SourcePipes the given pair x
into the function f
.
Given a pair x
and a function f
returns f(x)
.