use super::*; pub type WrapC<'a, A, Ctx> = Wrap<'a, A, >::T>; pub trait FunctorContext<'a>: 'a { type T: WeakFunctor<'a>; } pub trait FunctorContextExt<'a>: FunctorContext<'a> { fn fmap(fa: WrapC<'a, A, Self>, f: impl 'a + FnOnce(A) -> B) -> WrapC<'a, B, Self> where Self::T: Functor<'a>, { ::fmap(fa, f) } fn pure(a: A) -> WrapC<'a, A, Self> where Self::T: Pure<'a>, { ::pure(a) } fn bind( fa: WrapC<'a, A, Self>, f: impl 'a + FnOnce(A) -> WrapC<'a, B, Self>, ) -> WrapC<'a, B, Self> where Self::T: Monad<'a>, { ::bind(fa, f) } fn fail(e: E) -> WrapC<'a, A, Self> where Self::T: Fail<'a, E>, { >::fail(e) } } impl<'a, Ctx: FunctorContext<'a>> FunctorContextExt<'a> for Ctx {}