Implement Corepresentable for Morphism
This commit is contained in:
parent
4be8bc5dfc
commit
99ff1476aa
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -82,7 +82,7 @@ Functor f => Profunctor (Kleislimorphism f) where
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
-- Implementations for existing types
|
-- New profunctor types
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue