Copyright | (C) 2014-2015 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | GADTs, TFs, MPTCs, RankN |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- data Procompose (p :: k -> k1 -> Type) (q :: k2 -> k -> Type) (d :: k2) (c :: k1) where
- Procompose :: forall {k} {k1} {k2} (p :: k -> k1 -> Type) (x :: k) (c :: k1) (q :: k2 -> k -> Type) (d :: k2). p x c -> q d x -> Procompose p q d c
- procomposed :: forall {k} p (a :: k) (b :: k). Category p => Procompose p p a b -> p a b
- idl :: forall {k} (q :: Type -> Type -> Type) d c (r :: k -> Type -> Type) (d' :: k) c'. Profunctor q => Iso (Procompose (->) q d c) (Procompose (->) r d' c') (q d c) (r d' c')
- idr :: forall {k} (q :: Type -> Type -> Type) d c (r :: Type -> k -> Type) d' (c' :: k). Profunctor q => Iso (Procompose q (->) d c) (Procompose r (->) d' c') (q d c) (r d' c')
- assoc :: forall {k1} {k2} {k3} {k4} {k5} {k6} (p1 :: k1 -> k2 -> Type) (q :: k3 -> k1 -> Type) (r :: k4 -> k3 -> Type) (a :: k4) (b :: k2) (x :: k5 -> k2 -> Type) (y :: k6 -> k5 -> Type) (z :: k4 -> k6 -> Type) p2 f. (Profunctor p2, Functor f) => p2 (Procompose (Procompose p1 q) r a b) (f (Procompose (Procompose x y) z a b)) -> p2 (Procompose p1 (Procompose q r) a b) (f (Procompose x (Procompose y z) a b))
- eta :: forall (p :: Type -> Type -> Type). (Profunctor p, Category p) => (->) :-> p
- mu :: forall {k1} (p :: k1 -> k1 -> Type). Category p => Procompose p p :-> p
- stars :: forall {k1} {k2} (g :: Type -> Type) (f :: k1 -> Type) d (c :: k1) (f' :: k2 -> Type) (g' :: Type -> Type) d' (c' :: k2). Functor g => Iso (Procompose (Star f) (Star g) d c) (Procompose (Star f') (Star g') d' c') (Star (Compose g f) d c) (Star (Compose g' f') d' c')
- kleislis :: forall (g :: Type -> Type) (f :: Type -> Type) d c (f' :: Type -> Type) (g' :: Type -> Type) d' c'. Monad g => Iso (Procompose (Kleisli f) (Kleisli g) d c) (Procompose (Kleisli f') (Kleisli g') d' c') (Kleisli (Compose g f) d c) (Kleisli (Compose g' f') d' c')
- costars :: forall {k1} {k2} (f :: Type -> Type) (g :: k1 -> Type) (d :: k1) c (f' :: Type -> Type) (g' :: k2 -> Type) (d' :: k2) c'. Functor f => Iso (Procompose (Costar f) (Costar g) d c) (Procompose (Costar f') (Costar g') d' c') (Costar (Compose f g) d c) (Costar (Compose f' g') d' c')
- cokleislis :: forall {k1} {k2} (f :: Type -> Type) (g :: k1 -> Type) (d :: k1) c (f' :: Type -> Type) (g' :: k2 -> Type) (d' :: k2) c'. Functor f => Iso (Procompose (Cokleisli f) (Cokleisli g) d c) (Procompose (Cokleisli f') (Cokleisli g') d' c') (Cokleisli (Compose f g) d c) (Cokleisli (Compose f' g') d' c')
- newtype Rift (p :: k -> k1 -> Type) (q :: k2 -> k1 -> Type) (a :: k2) (b :: k) = Rift {
- runRift :: forall (x :: k1). p b x -> q a x
- decomposeRift :: forall {k1} {k2} {k3} (p :: k1 -> k2 -> Type) q (a :: k3) (b :: k2). Procompose p (Rift p q) a b -> q a b
Profunctor Composition
data Procompose (p :: k -> k1 -> Type) (q :: k2 -> k -> Type) (d :: k2) (c :: k1) where Source #
is the Procompose
p qProfunctor
composition of the
Profunctor
s p
and q
.
For a good explanation of Profunctor
composition in Haskell
see Dan Piponi's article:
http://blog.sigfpe.com/2011/07/profunctors-in-haskell.html
Procompose
has a polymorphic kind since 5.6
.
Procompose :: forall {k} {k1} {k2} (p :: k -> k1 -> Type) (x :: k) (c :: k1) (q :: k2 -> k -> Type) (d :: k2). p x c -> q d x -> Procompose p q d c |
Instances
procomposed :: forall {k} p (a :: k) (b :: k). Category p => Procompose p p a b -> p a b Source #
Unitors and Associator
idl :: forall {k} (q :: Type -> Type -> Type) d c (r :: k -> Type -> Type) (d' :: k) c'. Profunctor q => Iso (Procompose (->) q d c) (Procompose (->) r d' c') (q d c) (r d' c') Source #
(->)
functions as a lax identity for Profunctor
composition.
This provides an Iso
for the lens
package that witnesses the
isomorphism between
and Procompose
(->) q d cq d c
, which
is the left identity law.
idl
::Profunctor
q => Iso' (Procompose
(->) q d c) (q d c)
idr :: forall {k} (q :: Type -> Type -> Type) d c (r :: Type -> k -> Type) d' (c' :: k). Profunctor q => Iso (Procompose q (->) d c) (Procompose r (->) d' c') (q d c) (r d' c') Source #
(->)
functions as a lax identity for Profunctor
composition.
This provides an Iso
for the lens
package that witnesses the
isomorphism between
and Procompose
q (->) d cq d c
, which
is the right identity law.
idr
::Profunctor
q => Iso' (Procompose
q (->) d c) (q d c)
assoc :: forall {k1} {k2} {k3} {k4} {k5} {k6} (p1 :: k1 -> k2 -> Type) (q :: k3 -> k1 -> Type) (r :: k4 -> k3 -> Type) (a :: k4) (b :: k2) (x :: k5 -> k2 -> Type) (y :: k6 -> k5 -> Type) (z :: k4 -> k6 -> Type) p2 f. (Profunctor p2, Functor f) => p2 (Procompose (Procompose p1 q) r a b) (f (Procompose (Procompose x y) z a b)) -> p2 (Procompose p1 (Procompose q r) a b) (f (Procompose x (Procompose y z) a b)) Source #
The associator for Profunctor
composition.
This provides an Iso
for the lens
package that witnesses the
isomorphism between
and
Procompose
p (Procompose
q r) a b
, which arises because
Procompose
(Procompose
p q) r a bProf
is only a bicategory, rather than a strict 2-category.
Categories as monoid objects
eta :: forall (p :: Type -> Type -> Type). (Profunctor p, Category p) => (->) :-> p Source #
a Category
that is also a Profunctor
is a Monoid
in Prof
Generalized Composition
stars :: forall {k1} {k2} (g :: Type -> Type) (f :: k1 -> Type) d (c :: k1) (f' :: k2 -> Type) (g' :: Type -> Type) d' (c' :: k2). Functor g => Iso (Procompose (Star f) (Star g) d c) (Procompose (Star f') (Star g') d' c') (Star (Compose g f) d c) (Star (Compose g' f') d' c') Source #
Profunctor
composition generalizes Functor
composition in two ways.
This is the first, which shows that exists b. (a -> f b, b -> g c)
is
isomorphic to a -> f (g c)
.
stars
::Functor
f => Iso' (Procompose
(Star
f) (Star
g) d c) (Star
(Compose
f g) d c)
kleislis :: forall (g :: Type -> Type) (f :: Type -> Type) d c (f' :: Type -> Type) (g' :: Type -> Type) d' c'. Monad g => Iso (Procompose (Kleisli f) (Kleisli g) d c) (Procompose (Kleisli f') (Kleisli g') d' c') (Kleisli (Compose g f) d c) (Kleisli (Compose g' f') d' c') Source #
costars :: forall {k1} {k2} (f :: Type -> Type) (g :: k1 -> Type) (d :: k1) c (f' :: Type -> Type) (g' :: k2 -> Type) (d' :: k2) c'. Functor f => Iso (Procompose (Costar f) (Costar g) d c) (Procompose (Costar f') (Costar g') d' c') (Costar (Compose f g) d c) (Costar (Compose f' g') d' c') Source #
Profunctor
composition generalizes Functor
composition in two ways.
This is the second, which shows that exists b. (f a -> b, g b -> c)
is
isomorphic to g (f a) -> c
.
costars
::Functor
f => Iso' (Procompose
(Costar
f) (Costar
g) d c) (Costar
(Compose
g f) d c)
cokleislis :: forall {k1} {k2} (f :: Type -> Type) (g :: k1 -> Type) (d :: k1) c (f' :: Type -> Type) (g' :: k2 -> Type) (d' :: k2) c'. Functor f => Iso (Procompose (Cokleisli f) (Cokleisli g) d c) (Procompose (Cokleisli f') (Cokleisli g') d' c') (Cokleisli (Compose f g) d c) (Cokleisli (Compose f' g') d' c') Source #
This is a variant on costars
that uses Cokleisli
instead
of Costar
.
cokleislis
::Functor
f => Iso' (Procompose
(Cokleisli
f) (Cokleisli
g) d c) (Cokleisli
(Compose
g f) d c)
Right Kan Lift
newtype Rift (p :: k -> k1 -> Type) (q :: k2 -> k1 -> Type) (a :: k2) (b :: k) Source #
This represents the right Kan lift of a Profunctor
q
along a
Profunctor
p
in a limited version of the 2-category of Profunctors where
the only object is the category Hask, 1-morphisms are profunctors composed
and compose with Profunctor composition, and 2-morphisms are just natural
transformations.
Rift
has a polymorphic kind since 5.6
.
Instances
ProfunctorFunctor (Rift p :: (Type -> Type -> Type) -> Type -> k1 -> Type) Source # | |
p ~ q => Category (Rift p q :: k1 -> k1 -> Type) Source # |
|
Category p => ProfunctorComonad (Rift p :: (Type -> Type -> Type) -> Type -> Type -> Type) Source # | |
Defined in Data.Profunctor.Composition proextract :: forall (p0 :: Type -> Type -> Type). Profunctor p0 => Rift p p0 :-> p0 Source # produplicate :: forall (p0 :: Type -> Type -> Type). Profunctor p0 => Rift p p0 :-> Rift p (Rift p p0) Source # | |
ProfunctorAdjunction (Procompose p :: (Type -> Type -> Type) -> Type -> Type -> Type) (Rift p :: (Type -> Type -> Type) -> Type -> Type -> Type) Source # | |
Defined in Data.Profunctor.Composition unit :: forall (p0 :: Type -> Type -> Type). Profunctor p0 => p0 :-> Rift p (Procompose p p0) Source # counit :: forall (p0 :: Type -> Type -> Type). Profunctor p0 => Procompose p (Rift p p0) :-> p0 Source # | |
(Profunctor p, Profunctor q) => Profunctor (Rift p q) Source # | |
Defined in Data.Profunctor.Composition dimap :: (a -> b) -> (c -> d) -> Rift p q b c -> Rift p q a d Source # lmap :: (a -> b) -> Rift p q b c -> Rift p q a c Source # rmap :: (b -> c) -> Rift p q a b -> Rift p q a c Source # (#.) :: forall a b c q0. Coercible c b => q0 b c -> Rift p q a b -> Rift p q a c Source # (.#) :: forall a b c q0. Coercible b a => Rift p q b c -> q0 a b -> Rift p q a c Source # | |
Profunctor p => Functor (Rift p q a) Source # | |
decomposeRift :: forall {k1} {k2} {k3} (p :: k1 -> k2 -> Type) q (a :: k3) (b :: k2). Procompose p (Rift p q) a b -> q a b Source #
The 2-morphism that defines a left Kan lift.
Note: When p
is right adjoint to
then Rift
p (->)decomposeRift
is the counit
of the adjunction.