Module do_either

The Either Monad.

Behaviours: do_applicative, do_functor, do_monad.

Description

The Either Monad.

Data Types

either()

either(A, B) = {error, A} | {ok, B}

fn()

fn(A, B) = fun((A) -> B)

fn()

fn(A) = fun(() -> A)

map()

map(A) = #{term() := A}

maybe()

maybe(A) = {just, A} | nothing

monad()

monad(A) = [A] | either(term(), A) | maybe(A)

traversable()

traversable(A) = [A] | map(A)

Function Index

bind/2
do/2
fmap/2
lift/1
liftA2/2
liftm/2
liftmz/2
pure/1
sequence/1
then/2

Function Details

bind/2

bind(Either::either(D, A), F::fn(A, either(B, C))) -> either(B | D, C)

do/2

do(Either::either(A, B), Fs::[fn(B, either(C, D)) | fn(either(C, D))]) -> either(A | C, D)

fmap/2

fmap(F::fn(B, C), X2::either(A, B)) -> either(A, C)

lift/1

lift(F::fn(A, B)) -> fn(monad(A), monad(B))

liftA2/2

liftA2(X1::either(A1, fn(B, C)), Either::either(A2, B)) -> either(A1 | A2, C)

liftm/2

liftm(F::function(), Eithers::[either(term(), B)]) -> either(term(), B)

liftmz/2

liftmz(F::function(), Eithers::[fn(either(term(), B))]) -> either(term(), B)

pure/1

pure(B) -> either(term(), B)

sequence/1

sequence(Eithers::traversable(either(A, B))) -> either(A, traversable(B))

then/2

then(Either::either(A, term()), F::fn(either(B, C))) -> either(A | B, C)


Generated by EDoc