Module do_monad

The Monad Type Class.

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

Description

The Monad Type Class.

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) = {just, A} | nothing

monad()

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

Function Index

do/3
lift/2
liftm/3
liftmz/3
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(term())], Mod::atom()) -> monad(term())

liftmz/3

liftmz(F::function(), Thunks::[fn(monad(term()))], Mod::atom()) -> monad(term())

then/3

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


Generated by EDoc