lubeck 0.0.0-prealpha.5-abandoned

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

use super::Writer;

impl<'a, W, A> Functor<'a, A> for Writer<'a, W, A>
where
    W: Monoid + 'a,
    A: 'a,
{
    fn fmap<F, B>(self, f: F) -> Self::Type<B>
    where
        F: Fn(A) -> B + 'a,
        B: 'a,
    {
        Self::Type::<B> {
            run_writer: Some(Box::new(move |w: W| -> (B, W) {
                let (a, wt) = self.run();
                (f(a), wt.mappend(w))
            })),
        }
    }
}