Trait scsys_core::hkt::monad::Monad

source ·
pub trait Monad<U>: Applicative<U> {
    // Required method
    fn bind<F>(&self, fs: F) -> Self::T
       where F: FnMut(&Self::C) -> Self::T;

    // Provided methods
    fn return_(x: U) -> Self::T
       where Self: HKT<U, C = U> { ... }
    fn join<T>(&self) -> T
       where Self: HKT<U, T = T, C = T>,
             T: Clone { ... }
}

Required Methods§

source

fn bind<F>(&self, fs: F) -> Self::T
where F: FnMut(&Self::C) -> Self::T,

Provided Methods§

source

fn return_(x: U) -> Self::T
where Self: HKT<U, C = U>,

source

fn join<T>(&self) -> T
where Self: HKT<U, T = T, C = T>, T: Clone,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, U> Monad<U> for Option<T>

source§

fn bind<F>(&self, fs: F) -> Option<U>
where F: FnMut(&T) -> Option<U>,

source§

impl<T, U> Monad<U> for Box<T>

source§

fn bind<F>(&self, fs: F) -> Box<U>
where F: FnMut(&T) -> Box<U>,

source§

impl<T, U> Monad<U> for Rc<T>

source§

fn bind<F>(&self, fs: F) -> Rc<U>
where F: FnMut(&T) -> Rc<U>,

source§

impl<T, U> Monad<U> for Arc<T>

source§

fn bind<F>(&self, fs: F) -> Arc<U>
where F: FnMut(&T) -> Arc<U>,

source§

impl<T, U> Monad<U> for Vec<T>

source§

fn bind<F>(&self, fs: F) -> Vec<U>
where F: FnMut(&T) -> Vec<U>,

Implementors§