Trait kinder::lift::Monad
[−]
[src]
pub trait Monad<A>: Higher<A> { fn lift(x: A) -> Self::C
where
Self: Higher<A, B = A>; fn bind<F>(&self, _: F) -> Self::C
where
F: FnMut(&Self::B) -> Self::C; }
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
Required Methods
fn lift(x: A) -> Self::C where
Self: Higher<A, B = A>,
Self: Higher<A, B = A>,
fn bind<F>(&self, _: F) -> Self::C where
F: FnMut(&Self::B) -> Self::C,
F: FnMut(&Self::B) -> Self::C,
Implementors
impl<A, B> Monad<A> for Vec<B>
impl<A, B> Monad<A> for Option<B>
impl<A, B> Monad<A> for Box<B>
impl<A, B> Monad<A> for LinkedList<B>
impl<A: Clone, B: Clone> Monad<A> for VecDeque<B>
impl<A: Ord, B: Ord> Monad<A> for BTreeSet<B>
impl<A: Ord, B: Ord> Monad<A> for BinaryHeap<B>
impl<A: Eq + Hash, B: Eq + Hash> Monad<A> for HashSet<B>