func::local
isolation
This commit is contained in:
parent
6dfab12dbf
commit
fbdb056fa1
12
src/func.rs
12
src/func.rs
@ -15,6 +15,7 @@ pub mod derivations;
|
|||||||
mod extensions;
|
mod extensions;
|
||||||
pub mod fail;
|
pub mod fail;
|
||||||
pub mod instances;
|
pub mod instances;
|
||||||
|
pub mod local;
|
||||||
pub mod shared;
|
pub mod shared;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod test_suite;
|
pub mod test_suite;
|
||||||
@ -140,14 +141,3 @@ pub trait Monad<'a>: Applicative<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T: Monad<'a>> MonadExt<'a> for T {}
|
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<A: 'a, B: 'a>(state: Self::F<ControlFlow<B, A>>) -> ControlFlow<Self::F<B>, A> {
|
|
||||||
Self::stuff::<_, ControlFlowInstance<A>>(state)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Stuff wrapped result into another functor.
|
|
||||||
fn stuff<A: 'a, T: Pure<'a>>(fa: Self::F<T::F<A>>) -> T::F<Self::F<A>>;
|
|
||||||
}
|
|
||||||
|
@ -2,10 +2,11 @@ pub use super::{
|
|||||||
extensions::MonadExt,
|
extensions::MonadExt,
|
||||||
fail::{Fail, MonadFail, MonadFailAny, MonadFailAnyExt, WrapE},
|
fail::{Fail, MonadFail, MonadFailAny, MonadFailAnyExt, WrapE},
|
||||||
instances,
|
instances,
|
||||||
|
local::LocalFunctor,
|
||||||
shared::{SharedFunctor, SharedFunctorAny},
|
shared::{SharedFunctor, SharedFunctorAny},
|
||||||
Applicative, ApplicativeLA2, ApplicativeSelect, ApplicativeSelectExt, ApplicativeSeq,
|
Applicative, ApplicativeLA2, ApplicativeSelect, ApplicativeSelectExt, ApplicativeSeq,
|
||||||
ApplicativeTuple, ControlFlow, Functor, Iterative, IterativeWrapped, LocalFunctor, Monad, Pure,
|
ApplicativeTuple, ControlFlow, Functor, Iterative, IterativeWrapped, Monad, Pure, Selected,
|
||||||
Selected, SelectedWrapped, WeakFunctor, WeakFunctorAny, Wrap,
|
SelectedWrapped, WeakFunctor, WeakFunctorAny, Wrap,
|
||||||
};
|
};
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub use super::{test_suite, tests};
|
pub use super::{test_suite, tests};
|
||||||
|
12
src/func/local.rs
Normal file
12
src/func/local.rs
Normal file
@ -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<A: 'a, B: 'a>(state: Self::F<ControlFlow<B, A>>) -> ControlFlow<Self::F<B>, A> {
|
||||||
|
Self::stuff::<_, ControlFlowInstance<A>>(state)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Stuff wrapped result into another functor.
|
||||||
|
fn stuff<A: 'a, T: Pure<'a>>(fa: Self::F<T::F<A>>) -> T::F<Self::F<A>>;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user