SharedFunctor for CompositionClass

This commit is contained in:
AF 2023-04-25 10:52:40 +00:00
parent eb1c8f0167
commit 9d0d9028a4

View File

@ -145,3 +145,23 @@ impl<U: LocalFunctor + Functor, V: LocalFunctor> LocalFunctor for CompositionCla
U::stuff::<_, T>(U::fmap(V::stuff::<_, T>, fa)) U::stuff::<_, T>(U::fmap(V::stuff::<_, T>, fa))
} }
} }
impl<U: SharedFunctor + Functor, V: SharedFunctor> SharedFunctor for CompositionClass<U, V> {
type Shared<'a, A: 'a + Clone> = U::Shared<'a, V::Shared<'a, A>>
where
Self: 'a;
fn share<'a, A: 'a + Clone>(fa: Self::F<'a, A>) -> Self::Shared<'a, A>
where
Self: 'a,
{
U::share(U::fmap(V::share, fa))
}
fn unshare<'a, A: 'a + Clone>(sa: Self::Shared<'a, A>) -> Self::F<'a, A>
where
Self: 'a,
{
U::fmap(V::unshare, U::unshare(sa))
}
}