[][src]Struct monadic::writer_trans::WriterT

pub struct WriterT<M, W = String> { /* fields omitted */ }

Methods

impl<A, M, W> WriterT<M, W> where
    A: Clone,
    M: Clone + Monad<Item = A> + FromIterator<A>,
    W: Monoid + Clone
[src]

pub fn pure(x: A) -> Self[src]

This function requires to type annotate the inner monad, better use lift MonadInstance::pure(expr)

pub fn lift(m: M) -> Self[src]

lift a monad

pub fn lift_iter<I>(it: I) -> Self where
    I: Iterator<Item = A>, 
[src]

lift from iterator

pub fn bind<B: Clone, N: Clone, F>(self, f: F) -> WriterT<N, W> where
    F: Fn(A) -> WriterT<N, W>,
    N: MPlus<Item = B>, 
[src]

the destination inner monad must implement crate::monad::MPlus

pub fn unwrap_pair(self) -> (M, W)[src]

unwrap_pair returns the inner monad and log

pub fn unwrap(self) -> M[src]

unwrap returns the inner monad

pub fn listen(self) -> WriterT<Vec<(A, W)>, W>[src]

listen pairs the result with the log

pub fn listens<F, V>(self, f: F) -> WriterT<Vec<(A, V)>, W> where
    F: Fn(W) -> V, 
[src]

listens pairs the result with a projection of the log

pub fn censor<F: Fn(W) -> W>(self, f: F) -> Self[src]

censor modifies the log

Trait Implementations

impl<M: Clone, W: Clone> Clone for WriterT<M, W>[src]

Auto Trait Implementations

impl<M, W> RefUnwindSafe for WriterT<M, W> where
    M: RefUnwindSafe,
    W: RefUnwindSafe

impl<M, W> Send for WriterT<M, W> where
    M: Send,
    W: Send

impl<M, W> Sync for WriterT<M, W> where
    M: Sync,
    W: Sync

impl<M, W> Unpin for WriterT<M, W> where
    M: Unpin,
    W: Unpin

impl<M, W> UnwindSafe for WriterT<M, W> where
    M: UnwindSafe,
    W: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.