Module do_either

The Either Type.

Behaviours: do_applicative, do_functor, do_monad.

Description

The Either Type.

Data Types

either()

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

fn()

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

fn()

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

fn()

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

maybe()

maybe(A) = {ok, A} | error

monad()

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

traversable()

traversable(A) = [A] | #{term() := A}

Function Index

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

Function Details

bind/2

bind(F::fn(A, either(B, C)), Either::either(D, A)) -> 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/3

liftA2(F::fn(B, B, C), X2::either(A1, B), X3::either(A2, B)) -> either(A1 | A2, C)

liftm/2

liftm(F::function(), Eithers::[either(term(), B)] | [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(F::fn(either(A, B)), Either::either(term(), term())) -> either(A, B)


Generated by EDoc