Module kinder::lift [] [src]

Traits

Applicative

applicative trait, similar to Haskell's applicative class requires two functions: raise (normally pure): lifts a B to an A i.e Option::lift(2) = Some(2) apply (<*> in haskell): applies an applicative functor i.e Some(2).apply(Some(f)) => Some(f(2))

Foldable
Functor

functor trait, similar to Haskell's functor class requires a function fmap of type: &self -> Fn(&Self::B) -> A e.g Some(2).fmap(|x| x*x) = Some(4) None.fmap(|x| x*x) = None

Higher
Monad

monad trait, similar to Haskell's monad class requires two functions: lift (usually return but return is reserved): lifts an B to an A, i.e Option::return(2) = Some(2) bind: maps an A to an A i.e Some(2).bind(|x| Some(x+1)) = Some(3)

Monoid

monoid trait requires one function: id: &self -> A

SemiGroup

SemiGroup trait requires one function: add: &self -> &A -> A