Module do_monad

This module defines the do_monad behaviour.
Required callback functions: bind/2, do/2, then/2, lift/1, liftm/2.

Data Types

either()

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

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)

Function Index

do/3
lift/2
liftm/3
pure_with_ctx/1
then/3

Function Details

do/3

do(Monad::monad(A), Fs::[fn(A, monad(B)) | fn(monad(B))], Mod::atom()) -> monad(B)

lift/2

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

liftm/3

liftm(F::function(), Monads::[monad(A)] | [fn(monad(A))], Mod::atom()) -> monad(term())

pure_with_ctx/1

pure_with_ctx(Ctx) -> any()

then/3

then(F::fn(monad(A)), Monad::monad(term()), Mod::atom()) -> monad(A)


Generated by EDoc