auto-impl MonadContext
All checks were successful
buildbot/cargo fmt (1.72) Build done.
buildbot/cargo clippy (1.72) Build done.
buildbot/cargo doc (1.72) Build done.
buildbot/cargo test (1.65) Build done.
buildbot/cargo clippy (1.65) Build done.

This commit is contained in:
AF 2023-09-01 00:01:44 +00:00
parent 0954c86e92
commit 5cccad7022
8 changed files with 7 additions and 35 deletions

View File

@ -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),

View File

@ -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>;

View File

@ -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>,

View File

@ -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>;

View File

@ -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>,

View File

@ -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;

View File

@ -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;

View File

@ -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;