Implement Traversing profunctors

This commit is contained in:
Kiana Sheibani 2023-03-06 21:36:44 -05:00
parent 8cd11e401d
commit 22da62a6f5
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -1,5 +1,6 @@
module Data.Profunctor.Closed
import Data.Morphisms
import Data.Profunctor.Types
import Data.Profunctor.Functor
import Data.Profunctor.Strong
@ -12,6 +13,19 @@ interface Profunctor p => Closed p where
closed : p a b -> p (x -> a) (x -> b)
export
Closed Morphism where
closed (Mor f) = Mor (f .)
export
[Function] Closed (\a,b => a -> b) using Profunctor.Function where
closed = (.)
export
Functor f => Closed (Costar f) where
closed (MkCostar p) = MkCostar $ \f,x => p (map ($ x) f)
export
curry' : Closed p => p (a, b) c -> p a (b -> c)
curry' = lmap (,) . closed
@ -24,7 +38,6 @@ yon : (s -> a, s -> b) -> s -> (a,b)
yon h s = (fst h s, snd h s)
-- Closure
public export