Implement Corepresentable for Morphism

This commit is contained in:
Kiana Sheibani 2023-03-08 13:30:55 -05:00
parent 4be8bc5dfc
commit 99ff1476aa
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
4 changed files with 12 additions and 5 deletions

View file

@ -63,5 +63,5 @@ Functor g => Sieve p f => Sieve (Cayley g p) (g . f) using Functor.Compose where
export export
mapCayley : (forall x. f x -> g x) -> Cayley f p a b -> Cayley g p a b mapCayley : (forall x. f x -> g x) -> Cayley f p :-> Cayley g p
mapCayley f (MkCayley p) = MkCayley (f p) mapCayley f (MkCayley p) = MkCayley (f p)

View file

@ -61,9 +61,17 @@ export
Functor f => Representable (Star f) f where Functor f => Representable (Star f) f where
tabulate = MkStar tabulate = MkStar
export
Corepresentable Morphism Identity where
cotabulate f = Mor (f . Id)
namespace Corepresentable
||| A named implementation of `Corepresentable` for function types.
||| Use this to avoid having to use a type wrapper like `Morphism`.
export
[Function] Corepresentable (\a,b => a -> b) Identity using Cosieve.Function where
cotabulate = (. Id)
export export
Functor f => Corepresentable (Costar f) f where Functor f => Corepresentable (Costar f) f where
cotabulate = MkCostar cotabulate = MkCostar

View file

@ -48,7 +48,6 @@ Functor f => Sieve (Star f) f where
sieve = applyStar sieve = applyStar
export export
Cosieve Morphism Identity where Cosieve Morphism Identity where
cosieve (Mor f) = f . runIdentity cosieve (Mor f) = f . runIdentity

View file

@ -82,7 +82,7 @@ Functor f => Profunctor (Kleislimorphism f) where
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- Implementations for existing types -- New profunctor types
------------------------------------------------------------------------------ ------------------------------------------------------------------------------