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
either/3
errors/1
fmap/2
from_error/2
from_ok/2
is_error/1
is_ok/1
lift/1
liftA2/2
liftm/2
liftmz/2
oks/1
partition/1
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)

either/3

either(F1::fn(A, C), F2::fn(B, C), Either::either(A, B)) -> C

errors/1

errors(Eithers::[either(A, term())]) -> [A]

fmap/2

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

from_error/2

from_error(A, Either::either(A, term())) -> A

from_ok/2

from_ok(B, Either::either(term(), B)) -> B

is_error/1

is_error(Either::either(term(), term())) -> boolean()

is_ok/1

is_ok(Either::either(term(), term())) -> boolean()

lift/1

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

liftA2/2

liftA2(Either::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)

oks/1

oks(Eithers::[either(term(), B)]) -> [B]

partition/1

partition(Eithers::[either(A, B)]) -> {[A], [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