| Copyright | (C) 2011-2015 Edward Kmett |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | provisional |
| Portability | Type-Families |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Data.Profunctor.Rep
Description
Synopsis
- class (Sieve p (Rep p), Strong p) => Representable (p :: Type -> Type -> Type) where
- tabulated :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) d c d' c'. (Representable p, Representable q) => Iso (d -> Rep p c) (d' -> Rep q c') (p d c) (q d' c')
- firstRep :: Representable p => p a b -> p (a, c) (b, c)
- secondRep :: Representable p => p a b -> p (c, a) (c, b)
- class (Cosieve p (Corep p), Costrong p) => Corepresentable (p :: Type -> Type -> Type) where
- cotabulated :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) d c d' c'. (Corepresentable p, Corepresentable q) => Iso (Corep p d -> c) (Corep q d' -> c') (p d c) (q d' c')
- unfirstCorep :: Corepresentable p => p (a, d) (b, d) -> p a b
- unsecondCorep :: Corepresentable p => p (d, a) (d, b) -> p a b
- closedCorep :: Corepresentable p => p a b -> p (x -> a) (x -> b)
- data Prep (p :: Type -> k -> Type) (a :: k) where
- prepAdj :: forall {k1} (p :: Type -> k1 -> Type) g. (forall (a :: k1). Prep p a -> g a) -> p :-> Star g
- unprepAdj :: forall {k} (p :: Type -> k -> Type) g (a :: k). (p :-> Star g) -> Prep p a -> g a
- prepUnit :: forall {k} p a (b :: k). p a b -> Star (Prep p) a b
- prepCounit :: forall {k} f (a :: k). Prep (Star f) a -> f a
- newtype Coprep (p :: k -> Type -> Type) (a :: k) = Coprep {
- runCoprep :: forall r. p a r -> r
- coprepAdj :: forall {k} f (p :: k -> Type -> Type). (forall (a :: k). f a -> Coprep p a) -> p :-> Costar f
- uncoprepAdj :: forall {k} (p :: k -> Type -> Type) f (a :: k). (p :-> Costar f) -> f a -> Coprep p a
- coprepUnit :: forall {k} p (a :: k) b. p a b -> Costar (Coprep p) a b
- coprepCounit :: forall {k} f (a :: k). f a -> Coprep (Costar f) a
Representable Profunctors
class (Sieve p (Rep p), Strong p) => Representable (p :: Type -> Type -> Type) where Source #
A Profunctor p is Representable if there exists a Functor f such that
p d c is isomorphic to d -> f c.
Instances
| (Monad m, Functor m) => Representable (Kleisli m) Source # | |||||
| Representable (Forget r :: Type -> Type -> Type) Source # | |||||
| Functor f => Representable (Star f) Source # | |||||
| Representable (->) Source # | |||||
Defined in Data.Profunctor.Rep Associated Types
| |||||
| (Representable p, Representable q) => Representable (Procompose p q) Source # | The composition of two | ||||
Defined in Data.Profunctor.Composition Associated Types
Methods tabulate :: (d -> Rep (Procompose p q) c) -> Procompose p q d c Source # | |||||
tabulated :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) d c d' c'. (Representable p, Representable q) => Iso (d -> Rep p c) (d' -> Rep q c') (p d c) (q d' c') Source #
tabulate and sieve form two halves of an isomorphism.
This can be used with the combinators from the lens package.
tabulated::Representablep =>Iso'(d ->Repp c) (p d c)
firstRep :: Representable p => p a b -> p (a, c) (b, c) Source #
Default definition for first' given that p is Representable.
secondRep :: Representable p => p a b -> p (c, a) (c, b) Source #
Default definition for second' given that p is Representable.
Corepresentable Profunctors
class (Cosieve p (Corep p), Costrong p) => Corepresentable (p :: Type -> Type -> Type) where Source #
A Profunctor p is Corepresentable if there exists a Functor f such that
p d c is isomorphic to f d -> c.
Methods
cotabulate :: (Corep p d -> c) -> p d c Source #
Laws:
cotabulate.cosieve≡idcosieve.cotabulate≡id
Instances
| Corepresentable (Tagged :: Type -> Type -> Type) Source # | |||||
| Functor w => Corepresentable (Cokleisli w) Source # | |||||
Defined in Data.Profunctor.Rep Associated Types
| |||||
| Functor f => Corepresentable (Costar f) Source # | |||||
Defined in Data.Profunctor.Rep Associated Types
| |||||
| Corepresentable (->) Source # | |||||
Defined in Data.Profunctor.Rep Associated Types
Methods cotabulate :: (Corep (->) d -> c) -> d -> c Source # | |||||
| (Corepresentable p, Corepresentable q) => Corepresentable (Procompose p q) Source # | |||||
Defined in Data.Profunctor.Composition Associated Types
Methods cotabulate :: (Corep (Procompose p q) d -> c) -> Procompose p q d c Source # | |||||
cotabulated :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) d c d' c'. (Corepresentable p, Corepresentable q) => Iso (Corep p d -> c) (Corep q d' -> c') (p d c) (q d' c') Source #
cotabulate and cosieve form two halves of an isomorphism.
This can be used with the combinators from the lens package.
cotabulated::Corepf p =>Iso'(f d -> c) (p d c)
unfirstCorep :: Corepresentable p => p (a, d) (b, d) -> p a b Source #
Default definition for unfirst given that p is Corepresentable.
unsecondCorep :: Corepresentable p => p (d, a) (d, b) -> p a b Source #
Default definition for unsecond given that p is Corepresentable.
closedCorep :: Corepresentable p => p a b -> p (x -> a) (x -> b) Source #
Default definition for closed given that p is Corepresentable
Prep -| Star
data Prep (p :: Type -> k -> Type) (a :: k) where Source #
Prep-|Star:: [Hask, Hask] -> Prof
This gives rise to a monad in Prof, (, and
a comonad in Star.Prep)[Hask,Hask] (Prep.Star)
Prep has a polymorphic kind since 5.6.
Instances
| (Applicative (Rep p), Representable p) => Applicative (Prep p) Source # | |
| Profunctor p => Functor (Prep p) Source # | |
| (Monad (Rep p), Representable p) => Monad (Prep p) Source # | |
prepAdj :: forall {k1} (p :: Type -> k1 -> Type) g. (forall (a :: k1). Prep p a -> g a) -> p :-> Star g Source #
unprepAdj :: forall {k} (p :: Type -> k -> Type) g (a :: k). (p :-> Star g) -> Prep p a -> g a Source #
prepCounit :: forall {k} f (a :: k). Prep (Star f) a -> f a Source #
Coprep -| Costar
coprepAdj :: forall {k} f (p :: k -> Type -> Type). (forall (a :: k). f a -> Coprep p a) -> p :-> Costar f Source #
uncoprepAdj :: forall {k} (p :: k -> Type -> Type) f (a :: k). (p :-> Costar f) -> f a -> Coprep p a Source #
coprepUnit :: forall {k} p (a :: k) b. p a b -> Costar (Coprep p) a b Source #
coprepCounit :: forall {k} f (a :: k). f a -> Coprep (Costar f) a Source #