0 | module Data.Profunctor.Sieve
2 | import Control.Applicative.Const
3 | import Control.Monad.Identity
4 | import Data.Morphisms
5 | import Data.Profunctor
17 | interface (Profunctor p,
Functor f) => Sieve p f | p where
18 | sieve : p a b -> a -> f b
23 | interface (Profunctor p,
Functor f) => Cosieve p f | p where
24 | cosieve : p a b -> f a -> b
33 | Sieve Morphism Identity where
34 | sieve (Mor f) = Id . f
39 | [Function] Sieve (\a,b => a -> b) Prelude.id using Profunctor.Function FunctorId where
43 | Functor f => Sieve (Kleislimorphism f) f where
44 | sieve = applyKleisli
47 | Functor f => Sieve (Star f) f where
51 | Sieve (Forget r) (Const r) where
52 | sieve (MkForget k) = MkConst . k
56 | Cosieve Morphism Identity where
57 | cosieve (Mor f) = f . runIdentity
63 | [Function] Cosieve (\a,b => a -> b) Prelude.id using Profunctor.Function FunctorId where
67 | Functor f => Cosieve (Costar f) f where
68 | cosieve = applyCostar
71 | Cosieve (Coforget r) (Const r) where
72 | cosieve (MkCoforget k) = k . runConst