[−][src]Struct monadic::writer_trans::WriterT
Methods
impl<A, M, W> WriterT<M, W> where
A: Clone,
M: Clone + Monad<Item = A> + FromIterator<A>,
W: Monoid + Clone,
[src]
A: Clone,
M: Clone + Monad<Item = A> + FromIterator<A>,
W: Monoid + Clone,
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]
I: Iterator<Item = A>,
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]
F: Fn(A) -> WriterT<N, W>,
N: MPlus<Item = B>,
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]
F: Fn(W) -> V,
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
Auto Trait Implementations
impl<M, W> RefUnwindSafe for WriterT<M, W> where
M: RefUnwindSafe,
W: RefUnwindSafe,
M: RefUnwindSafe,
W: RefUnwindSafe,
impl<M, W> Send for WriterT<M, W> where
M: Send,
W: Send,
M: Send,
W: Send,
impl<M, W> Sync for WriterT<M, W> where
M: Sync,
W: Sync,
M: Sync,
W: Sync,
impl<M, W> Unpin for WriterT<M, W> where
M: Unpin,
W: Unpin,
M: Unpin,
W: Unpin,
impl<M, W> UnwindSafe for WriterT<M, W> where
M: UnwindSafe,
W: UnwindSafe,
M: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,