auto-impl MonadContext
This commit is contained in:
parent
0954c86e92
commit
5cccad7022
@ -37,10 +37,6 @@ impl<'a, BT: FunctorContext<'a>> FunctorContext<'a> for BalancedTrees<BT> {
|
|||||||
type T = BT::T;
|
type T = BT::T;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, BT: MonadContext<'a>> MonadContext<'a> for BalancedTrees<BT> {
|
|
||||||
type _Tm = Self::T;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum BalancingError {
|
pub enum BalancingError {
|
||||||
Height(HeightError),
|
Height(HeightError),
|
||||||
|
@ -43,10 +43,6 @@ impl<'a, BT: FunctorContext<'a>> FunctorContext<'a> for BoundTrees<BT> {
|
|||||||
type T = BT::T;
|
type T = BT::T;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, BT: MonadContext<'a>> MonadContext<'a> for BoundTrees<BT> {
|
|
||||||
type _Tm = Self::T;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait BinaryTreesBindable<'a>: MonadTrees<'a> {
|
pub trait BinaryTreesBindable<'a>: MonadTrees<'a> {
|
||||||
fn bounds_error<T: 'a + Send>(&self, error: BoundsError<Self::Key>) -> BTWrap<'a, Self, T>;
|
fn bounds_error<T: 'a + Send>(&self, error: BoundsError<Self::Key>) -> BTWrap<'a, Self, T>;
|
||||||
|
|
||||||
|
@ -10,6 +10,13 @@ pub trait MonadContext<'a>: FunctorContext<'a, T = Self::_Tm> {
|
|||||||
type _Tm: Monad<'a>;
|
type _Tm: Monad<'a>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a, Ctx: FunctorContext<'a>> MonadContext<'a> for Ctx
|
||||||
|
where
|
||||||
|
Ctx::T: Monad<'a>,
|
||||||
|
{
|
||||||
|
type _Tm = Ctx::T;
|
||||||
|
}
|
||||||
|
|
||||||
pub trait FunctorContextExt<'a>: FunctorContext<'a> {
|
pub trait FunctorContextExt<'a>: FunctorContext<'a> {
|
||||||
fn fmap<A: 'a + Send, B: 'a + Send>(
|
fn fmap<A: 'a + Send, B: 'a + Send>(
|
||||||
fa: WrapC<'a, A, Self>,
|
fa: WrapC<'a, A, Self>,
|
||||||
|
@ -86,10 +86,6 @@ impl<'a, A: 'a + Send> FunctorContext<'a> for Trees<A> {
|
|||||||
type T = instances::solo::SoloInstance;
|
type T = instances::solo::SoloInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, A: 'a + Send> MonadContext<'a> for Trees<A> {
|
|
||||||
type _Tm = Self::T;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<A: Send + Sync + Ord + Clone> BinaryTrees for Trees<A> {
|
impl<A: Send + Sync + Ord + Clone> BinaryTrees for Trees<A> {
|
||||||
type Node = Node<A>;
|
type Node = Node<A>;
|
||||||
type Reference = Reference<A>;
|
type Reference = Reference<A>;
|
||||||
|
@ -69,17 +69,6 @@ impl<
|
|||||||
type T = FallibleMonad<'a, Ctx, TreeContextError<'a, Ctx, A, E>>;
|
type T = FallibleMonad<'a, Ctx, TreeContextError<'a, Ctx, A, E>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<
|
|
||||||
'a,
|
|
||||||
Ctx: Context<'a>,
|
|
||||||
A: Mentionable<'a, Ctx> + Clone,
|
|
||||||
C: 'a + Comparator<A>,
|
|
||||||
E: 'a + Send,
|
|
||||||
> MonadContext<'a> for TreeContext2<'a, Ctx, A, C, E>
|
|
||||||
{
|
|
||||||
type _Tm = Self::T;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<
|
impl<
|
||||||
'a,
|
'a,
|
||||||
Ctx: Context<'a>,
|
Ctx: Context<'a>,
|
||||||
|
@ -72,10 +72,6 @@ impl<'a> FallibleCtx<'a> for TestContextPlain {
|
|||||||
type Fallible = instances::result::ResultFailAny;
|
type Fallible = instances::result::ResultFailAny;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MonadContext<'a> for TestContextPlain {
|
|
||||||
type _Tm = Self::T;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Context<'a> for TestContextPlain {
|
impl<'a> Context<'a> for TestContextPlain {
|
||||||
type D = NoDiagnostic;
|
type D = NoDiagnostic;
|
||||||
|
|
||||||
|
@ -15,10 +15,6 @@ impl<'a> FallibleCtx<'a> for TestContextCounted {
|
|||||||
type Fallible = instances::result::ResultFailOver<Self::T>;
|
type Fallible = instances::result::ResultFailOver<Self::T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MonadContext<'a> for TestContextCounted {
|
|
||||||
type _Tm = Self::T;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Context<'a> for TestContextCounted {
|
impl<'a> Context<'a> for TestContextCounted {
|
||||||
type D = NoDiagnostic;
|
type D = NoDiagnostic;
|
||||||
|
|
||||||
|
@ -14,10 +14,6 @@ impl<'a> FallibleCtx<'a> for TestContextTraced {
|
|||||||
type Fallible = instances::result::ResultFailOver<Self::T>;
|
type Fallible = instances::result::ResultFailOver<Self::T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> MonadContext<'a> for TestContextTraced {
|
|
||||||
type _Tm = Self::T;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Context<'a> for TestContextTraced {
|
impl<'a> Context<'a> for TestContextTraced {
|
||||||
type D = TracedDiagnostic;
|
type D = TracedDiagnostic;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user