Safe Haskell | Safe |
---|---|
Language | Haskell98 |
This module defines functors in the category of proxies
- class PFunctor t where
- hoistPK :: (Monad m, Proxy p1, PFunctor t) => (forall r1. p1 a' a b' b m r1 -> p2 a' a b' b n r1) -> (q -> t p1 a' a b' b m r2) -> q -> t p2 a' a b' b n r2
- raiseP :: (Monad m, Proxy p, PFunctor t1, ProxyTrans t2) => t1 p a' a b' b m r -> t1 (t2 p) a' a b' b m r
- raisePK :: (Monad m, Proxy p, PFunctor t1, ProxyTrans t2) => (q -> t1 p a' a b' b m r) -> q -> t1 (t2 p) a' a b' b m r
Functors over Proxies
class PFunctor t where Source #
A functor in the category of proxies
hoistP f . hoistP g = hoistP (f . g) hoistP id = id
If f
is a proxy morphism, then hoistP f
is a proxy morphism, meaning
that hoistPK f = (hoistP f .)
defines a functor between five categories.
Functor between Kleisli categories:
hoistPK f p1 >=> hoistPK f p2 = hoistPK f (p1 >=> p2) hoistPK f return = return
Functor between Proxy
categories:
hoistPK f p1 >-> hoistPK f p2 = hoistPK f (p1 >-> p2) hoistPK f idT = idT
hoistPK f p1 >~> hoistPK f p2 = hoistPK f (p1 >~> p2) hoistPK f coidT = coidT
Functor between "request" categories:
hoistPK f p1 \>\ hoistPK f p2 = hoistPK f (p2 \>\ p2) hoistPK f request = request
Functor between "respond" categories:
hoistPK f p1 />/ hoistPK f p2 = hoistPK f (p2 />/ p2) hoistPK f respond = respond
:: (Monad m, Proxy p1, PFunctor t) | |
=> (forall r1. p1 a' a b' b m r1 -> p2 a' a b' b n r1) | Proxy morphism |
-> (q -> t p1 a' a b' b m r2) | Proxy Kleisli arrow |
-> q -> t p2 a' a b' b n r2 |
Convenience function equivalent to (hoistP f .)
:: (Monad m, Proxy p, PFunctor t1, ProxyTrans t2) | |
=> t1 p a' a b' b m r | Proxy |
-> t1 (t2 p) a' a b' b m r |
Lift the base proxy
raiseP = hoistP liftP