diff --git a/src/func/instances/composition.rs b/src/func/instances/composition.rs index 8e9440b..135ae21 100644 --- a/src/func/instances/composition.rs +++ b/src/func/instances/composition.rs @@ -187,22 +187,34 @@ mod composition_tests { type T = CompositionInstance>; - impl<'a> tests::ToEq<'a> for T { - type Eq = Self::F; + impl<'a, U: tests::ToEq<'a> + Functor<'a>, V: tests::ToEq<'a>> tests::ToEq<'a> + for CompositionInstance + { + type Eq = U::Eq>; fn to_eq(fa: Self::F) -> Self::Eq { - fa + U::to_eq(U::fmap(fa, V::to_eq)) } } - impl<'a> test_suite::FunctorTestSuite<'a> for T { + fn regularise<'a, U: WeakFunctor<'a>, V: WeakFunctor<'a>, A: 'a + Send>( + fua: U::F>, + ) -> as WeakFunctor<'a>>::F { + fua + } + + impl<'a, U: test_suite::FunctorTestSuite<'a>, V: test_suite::FunctorTestSuite<'a>> + test_suite::FunctorTestSuite<'a> for CompositionInstance + where + Self: tests::Eqr<'a>, + { fn sample>>)>( mut f: F, ) { - OptionInstance::sample(|ua0| { - ResultInstance::sample(|a0| { + U::sample(|ua0| { + V::sample(|a0| { let ua0 = ua0.clone(); - f(Arc::new(move |a| ua0(a0(a)))) + f(Arc::new(move |a| regularise(ua0(a0(a))))) }) }); } diff --git a/src/func/tests.rs b/src/func/tests.rs index 356f6ec..f971435 100644 --- a/src/func/tests.rs +++ b/src/func/tests.rs @@ -41,7 +41,7 @@ pub trait Eqr<'a>: WeakFunctor<'a> { } pub trait ToEq<'a>: WeakFunctor<'a> { - type Eq: PartialEq + Debug; + type Eq: 'a + Send + PartialEq + Debug; fn to_eq(fa: Self::F) -> Self::Eq; }