lubeck 0.0.0-prealpha.5-abandoned

Functional programming framework written in cutting edge rust
Documentation
use crate::traits::{Monad, Monoid};

use super::Writer;

impl<'a, W, A> Monad<'a, A> for Writer<'a, W, A>
where
    W: Monoid + 'a,
    A: 'a,
{
    fn bind<F, B>(self, f: F) -> Self::Type<B>
    where
        F: Fn(A) -> Self::Type<B> + 'a,
        B: 'a,
    {
        Self::Type::<B> {
            run_writer: Some(Box::new(move |w: W| -> (B, W) {
                let (a, w1) = self.run_with(w);
                let writer_f = f(a);
                let (b, w2) = writer_f.run_with(w1);
                (b, w2)
            })),
        }
    }
}