ATSLIB/libats/ML/monad_maybe
This package gives an implementation of maybe-monad in ML-style.
Synopsis
typedef
monad(a:t@ype) = monad_type(a)
Synopsis
abstype
monad_type(a:t@ype+) = ptr
Synopsis
fun
{a:t0p}
{b:t0p}
monad_bind
(
monad(a), cfun(a, monad(b))
) : monad(b)
Synopsis
fun
{a1
,a2:t0p
}{b:t0p}
monad_bind2
(
monad(a1), monad(a2), cfun(a1, a2, monad(b))
) : monad(b)
Synopsis
fun
{a1
,a2
,a3:t0p
}{b:t0p}
monad_bind3
(
monad(a1), monad(a2), monad(a3), cfun(a1, a2, a3, monad(b))
) : monad(b)
Synopsis
fun{a:t0p}
monad_return(x: a): monad(a)
Synopsis
fun{} monad_unit(): monad(unit)
Synopsis
fun
{a:t0p}
monad_nil(): monad(list0(a))
Synopsis
fun
{a:t0p}
monad_cons
(
monad(INV(a)), monad(list0(a))
) : monad(list0(a))
Synopsis
fun{
a1,a2:t0p
} monad_seq
(
m1: monad(INV(a1)), m2: monad(INV(a2))
): monad(a2)
Synopsis
fun{a:t0p}
monad_join(monad(monad(INV(a)))): monad(a)
Synopsis
fun
{a:t0p}
{b:t0p}
monad_fmap(cfun(a, b), monad(a)): monad(b)
Synopsis
fun
{a:t0p}
{b:t0p}
monad_liftm (cfun(a, b), monad(a)): monad(b)
Synopsis
fun
{a1
,a2:t0p
}{b:t0p}
monad_liftm2
(cfun(a1, a2, b), monad(a1), monad(a2)): monad(b)
Synopsis
fun
{a1
,a2
,a3:t0p
}{b:t0p}
monad_liftm3
(cfun(a1, a2, a3, b), monad(a1), monad(a2), monad(a3)): monad(b)
Synopsis
fun
{a:t0p}
{b:t0p}
monad_mapm
(cfun(a, b), list0(monad(a))): monad(list0(b))
Synopsis
fun
{a:t0p}
{b:t0p}
monad_mapm_(cfun(a, monad(b)), list0(a)): monad(unit)
Synopsis
fun{a:t0p}
monad_seqlist
(list0(monad(INV(a)))): monad(list0(a))
Synopsis
fun{a:t0p}
monad_seqlist_(list0(monad(INV(a)))): monad(unit)
Synopsis
fun{a:t0p}
monad_maybe_none(): monad(a)
Synopsis
fun{a:t0p}
monad_maybe_some(x0: a): monad(a)
Synopsis
fun{a:t0p}
monad_maybe_optize
(m0: monad(INV(a))): Option(a)
Description
This function, which is just an identity, turns a maybe-monad into an option-value.
Synopsis
fun
{a:t0p}
fprint_monad
(out: FILEref, m: monad(INV(a))): void
Description
This function prints out a maybe-monad onto a given channel.