use super::*; /// Represents iteration state. pub enum IState { /// Loop running. Pending(P), /// Loop finished. Done(D), } pub struct IStateClass

(P); impl

WeakFunctor for IStateClass

{ type F<'a, A: 'a> = IState where Self: 'a; } impl

Functor for IStateClass

{ fn fmap<'a, A: 'a, B: 'a>(f: impl 'a + FnOnce(A) -> B, fa: Self::F<'a, A>) -> Self::F<'a, B> where Self: 'a, { match fa { IState::Pending(p) => IState::Pending(p), IState::Done(d) => IState::Done(f(d)), } } } impl

Pure for IStateClass

{ fn pure<'a, A: 'a>(a: A) -> Self::F<'a, A> where Self: 'a, { IState::Done(a) } }