diff --git a/src/func/context.rs b/src/func/context.rs index 64b1850..9ce5484 100644 --- a/src/func/context.rs +++ b/src/func/context.rs @@ -52,3 +52,20 @@ pub type FallibleMonad<'a, Ctx, E> = <>::Fallible as Mona /// Preferred [Wrap]ped [Result]. pub type FallibleWrapped<'a, Ctx, A, E> = Wrap<'a, A, FallibleMonad<'a, Ctx, E>>; + +/// Extention trait for simpler conversion between [`FunctorContext::T`] and [`FallibleCtx::Fallible`]. +/// +/// this is the preferred way to switch between [WrapC] and [FallibleWrapped]. +pub trait FallibleCtxExt<'a>: FallibleCtx<'a> { + /// Convert a fallible wrapped into a wrapped result. + fn unstuff(wa: FallibleWrapped<'a, Self, A, E>) -> WrapC<'a, Result, Self> { + Self::Fallible::unstuff(wa) + } + + /// Convert a wrapped result into a fallible wrapped. + fn stuff(fa: WrapC<'a, Result, Self>) -> FallibleWrapped<'a, Self, A, E> { + Self::Fallible::stuff(fa) + } +} + +impl<'a, Ctx: FallibleCtx<'a>> FallibleCtxExt<'a> for Ctx {} diff --git a/src/rstd.rs b/src/rstd.rs index 3753847..1d706d4 100644 --- a/src/rstd.rs +++ b/src/rstd.rs @@ -3,7 +3,6 @@ pub mod atomic; pub mod cast; pub mod collections; -pub mod fallible; pub mod inject; pub mod inlining; mod local_origin; diff --git a/src/rstd/collections/tree/context.rs b/src/rstd/collections/tree/context.rs index 76ba63c..495f111 100644 --- a/src/rstd/collections/tree/context.rs +++ b/src/rstd/collections/tree/context.rs @@ -7,7 +7,6 @@ use crate::{ }, func::context::*, rcore::*, - rstd::fallible::*, }; use super::*; diff --git a/src/rstd/fallible.rs b/src/rstd/fallible.rs deleted file mode 100644 index 892cfec..0000000 --- a/src/rstd/fallible.rs +++ /dev/null @@ -1,24 +0,0 @@ -//! Shorthands for using [`Context::Fallible`]. - -use fail::*; - -use crate::func::context::*; - -use super::*; - -/// Extention trait for simpler conversion between [`FunctorContext::T`] and [`FallibleCtx::Fallible`]. -/// -/// this is the preferred way to switch between [WrapC] and [FallibleWrapped]. -pub trait FallibleCtxExt<'a>: FallibleCtx<'a> { - /// Convert a fallible wrapped into a wrapped result. - fn unstuff(wa: FallibleWrapped<'a, Self, A, E>) -> WrapC<'a, Result, Self> { - Self::Fallible::unstuff(wa) - } - - /// Convert a wrapped result into a fallible wrapped. - fn stuff(fa: WrapC<'a, Result, Self>) -> FallibleWrapped<'a, Self, A, E> { - Self::Fallible::stuff(fa) - } -} - -impl<'a, Ctx: FallibleCtx<'a>> FallibleCtxExt<'a> for Ctx {}