diff --git a/src/func.rs b/src/func.rs index 6cccc9a..8de894b 100644 --- a/src/func.rs +++ b/src/func.rs @@ -15,6 +15,7 @@ pub mod derivations; mod extensions; pub mod fail; pub mod instances; +pub mod local; pub mod shared; #[cfg(test)] pub mod test_suite; @@ -140,14 +141,3 @@ pub trait Monad<'a>: Applicative<'a> { } impl<'a, T: Monad<'a>> MonadExt<'a> for T {} - -/// Represents wrapped results which are instantly available. -pub trait LocalFunctor<'a>: WeakFunctor<'a> { - /// Extract iteration state, if successful. - fn unstuff(state: Self::F>) -> ControlFlow, A> { - Self::stuff::<_, ControlFlowInstance>(state) - } - - /// Stuff wrapped result into another functor. - fn stuff>(fa: Self::F>) -> T::F>; -} diff --git a/src/func/class_prelude.rs b/src/func/class_prelude.rs index 24edd46..dff5120 100644 --- a/src/func/class_prelude.rs +++ b/src/func/class_prelude.rs @@ -2,10 +2,11 @@ pub use super::{ extensions::MonadExt, fail::{Fail, MonadFail, MonadFailAny, MonadFailAnyExt, WrapE}, instances, + local::LocalFunctor, shared::{SharedFunctor, SharedFunctorAny}, Applicative, ApplicativeLA2, ApplicativeSelect, ApplicativeSelectExt, ApplicativeSeq, - ApplicativeTuple, ControlFlow, Functor, Iterative, IterativeWrapped, LocalFunctor, Monad, Pure, - Selected, SelectedWrapped, WeakFunctor, WeakFunctorAny, Wrap, + ApplicativeTuple, ControlFlow, Functor, Iterative, IterativeWrapped, Monad, Pure, Selected, + SelectedWrapped, WeakFunctor, WeakFunctorAny, Wrap, }; #[cfg(test)] pub use super::{test_suite, tests}; diff --git a/src/func/local.rs b/src/func/local.rs new file mode 100644 index 0000000..373bdfa --- /dev/null +++ b/src/func/local.rs @@ -0,0 +1,12 @@ +use super::*; + +/// Represents wrapped results which are instantly available. +pub trait LocalFunctor<'a>: WeakFunctor<'a> { + /// Extract iteration state, if successful. + fn unstuff(state: Self::F>) -> ControlFlow, A> { + Self::stuff::<_, ControlFlowInstance>(state) + } + + /// Stuff wrapped result into another functor. + fn stuff>(fa: Self::F>) -> T::F>; +}