diff --git a/src/standard/reader.rs b/src/standard/reader.rs index 607ba39..fe1a4cf 100644 --- a/src/standard/reader.rs +++ b/src/standard/reader.rs @@ -23,7 +23,7 @@ impl<'e, E, F: Functor<'e> + 'e> Functor<'e> for ReaderK<'e, E, F> { } } -impl<'e, E, F: Applicative<'e> + 'e> Applicative<'e> for ReaderK<'e, E, F> { +impl<'e, E: Clone, F: Applicative<'e> + 'e> Applicative<'e> for ReaderK<'e, E, F> { fn pure(a: A) -> Self::T { Reader(Box::new(|_| F::pure(a)), PhantomData) } @@ -33,6 +33,9 @@ impl<'e, E, F: Applicative<'e> + 'e> Applicative<'e> for ReaderK<'e, E, F> { A: Clone, MAP: Fn(A) -> B, { - todo!() + let Reader(vf, _) = mf; + let Reader(va, _) = ma; + let run = |e: E| F::apply(vf(e.clone()), va(e)); + Reader(Box::new(run), PhantomData) } }