Module do_either

The Either Monad.

Behaviours: do_applicative, do_foldable, do_functor, do_monad, do_monoid, do_semigroup, do_traversable.

Description

The Either Monad.

Data Types

applicative()

applicative(A) = [A] | fn(term(), A) | either(term(), A) | maybe(A)

either()

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

fn()

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

fn()

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

fn()

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

maybe()

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

monad()

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

Function Index

append/2
bind/2
do/2
either/3
errors/1
fmap/2
foldr/3
from_error/2
from_ok/2
is_error/1
is_ok/1
lift/1
liftA2/2
liftm/2
mempty/0
oks/1
partition/1
pure/1
sequence/1
then/2
traverse/2

Function Details

append/2

append(X1::either(A, B), X2::either(A, B)) -> either(A, B)

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)

foldr/3

foldr(F::fn(B, C, C), B, X3::either(term(), B)) -> 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)

mempty/0

mempty() -> either(atom(), term())

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(Either::either(A, applicative(B))) -> applicative(either(A, B))

then/2

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

traverse/2

traverse(F::fn(A, applicative(B)), Either::either(A, B)) -> applicative(either(A, B))


Generated by EDoc