| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Profunctor.Optic.Type
Contents
Synopsis
- type Optic p s t a b = p a b -> p s t
- type Optic' p s a = Optic p s s a a
- between :: (c -> d) -> (a -> b) -> (b -> c) -> a -> d
- type IndexedOptic p i s t a b = p (i, a) b -> p (i, s) t
- type IndexedOptic' p i s a = IndexedOptic p i s s a a
- type CoindexedOptic p k s t a b = p a (k -> b) -> p s (k -> t)
- type CoindexedOptic' p k t b = CoindexedOptic p k t t b b
- type Equality s t a b = forall p. Optic p s t a b
- type Equality' s a = Equality s s a a
- type As a = Equality' a a
- type Iso s t a b = forall p. Profunctor p => Optic p s t a b
- type Iso' s a = Iso s s a a
- type Lens s t a b = forall p. Strong p => Optic p s t a b
- type Lens' s a = Lens s s a a
- type Ixlens i s t a b = forall p. Strong p => IndexedOptic p i s t a b
- type Ixlens' i s a = Ixlens i s s a a
- type Colens s t a b = forall p. Costrong p => Optic p s t a b
- type Colens' s a = Colens s s a a
- type Cxlens k s t a b = forall p. Costrong p => CoindexedOptic p k s t a b
- type Cxlens' k s a = Cxlens k s s a a
- type Prism s t a b = forall p. Choice p => Optic p s t a b
- type Prism' s a = Prism s s a a
- type Cxprism k s t a b = forall p. Choice p => CoindexedOptic p k s t a b
- type Cxprism' k s a = Cxprism k s s a a
- type Coprism s t a b = forall p. Cochoice p => Optic p s t a b
- type Coprism' t b = Coprism t t b b
- type Ixprism i s t a b = forall p. Cochoice p => IndexedOptic p i s t a b
- type Ixprism' i s a = Coprism s s a a
- type Grate s t a b = forall p. Closed p => Optic p s t a b
- type Grate' s a = Grate s s a a
- type Cxgrate k s t a b = forall p. Closed p => CoindexedOptic p k s t a b
- type Cxgrate' k s a = Cxgrate k s s a a
- type Traversal s t a b = forall p. (Choice p, Representable p, Applicative (Rep p)) => Optic p s t a b
- type Traversal' s a = Traversal s s a a
- type Ixtraversal i s t a b = forall p. (Choice p, Representable p, Applicative (Rep p)) => IndexedOptic p i s t a b
- type Ixtraversal' i s a = Ixtraversal i s s a a
- type Traversal0 s t a b = forall p. (Strong p, Choice p) => Optic p s t a b
- type Traversal0' s a = Traversal0 s s a a
- type Ixtraversal0 i s t a b = forall p. (Strong p, Choice p) => IndexedOptic p i s t a b
- type Ixtraversal0' i s a = Ixtraversal0 i s s a a
- type Traversal1 s t a b = forall p. (Choice p, Representable p, Apply (Rep p)) => Optic p s t a b
- type Traversal1' s a = Traversal1 s s a a
- type Cotraversal1 s t a b = forall p. (Closed p, Corepresentable p, Apply (Corep p)) => Optic p s t a b
- type Cotraversal1' s a = Cotraversal1 s s a a
- type Cxtraversal1 k s t a b = forall p. (Closed p, Corepresentable p, Apply (Corep p)) => CoindexedOptic p k s t a b
- type Cxtraversal1' k s a = Cxtraversal1 k s s a a
- type Fold0 s a = forall p. (Choice p, Representable p, Applicative (Rep p), forall x. Contravariant (p x)) => Optic' p s a
- type Ixfold0 i s a = forall p. (Choice p, Strong p, forall x. Contravariant (p x)) => IndexedOptic' p i s a
- type Fold s a = forall p. (Choice p, Representable p, Applicative (Rep p), forall x. Contravariant (p x)) => Optic' p s a
- type Ixfold i s a = forall p. (Choice p, Representable p, Applicative (Rep p), forall x. Contravariant (p x)) => IndexedOptic' p i s a
- type Fold1 s a = forall p. (Choice p, Representable p, Apply (Rep p), forall x. Contravariant (p x)) => Optic p s s a a
- type Cofold1 t b = forall p. (Cochoice p, Corepresentable p, Apply (Corep p), Bifunctor p) => Optic p t t b b
- type PrimView s t a b = forall p. (Profunctor p, forall x. Contravariant (p x)) => Optic p s t a b
- type View s a = forall p. (Strong p, forall x. Contravariant (p x)) => Optic' p s a
- type Ixview i s a = forall p. (Strong p, forall x. Contravariant (p x)) => IndexedOptic' p i s a
- type PrimReview s t a b = forall p. (Profunctor p, Bifunctor p) => Optic p s t a b
- type Review t b = forall p. (Costrong p, Bifunctor p) => Optic' p t b
- type Cxview k t b = forall p. (Costrong p, Bifunctor p) => CoindexedOptic' p k t b
- type Setter s t a b = forall p. (Closed p, Choice p, Representable p, Applicative (Rep p), Distributive (Rep p)) => Optic p s t a b
- type Setter' s a = Setter s s a a
- type Ixsetter i s t a b = forall p. (Closed p, Choice p, Representable p, Applicative (Rep p), Distributive (Rep p)) => IndexedOptic p i s t a b
- type Resetter s t a b = forall p. (Closed p, Cochoice p, Corepresentable p, Apply (Corep p), Traversable (Corep p)) => Optic p s t a b
- type Resetter' s a = Resetter s s a a
- type Cxsetter k s t a b = forall p. (Closed p, Cochoice p, Corepresentable p, Apply (Corep p), Traversable (Corep p)) => CoindexedOptic p k s t a b
- type ARepn f s t a b = Optic (Star f) s t a b
- type ARepn' f s a = ARepn f s s a a
- type AIxrepn f i s t a b = IndexedOptic (Star f) i s t a b
- type AIxrepn' f i s a = AIxrepn f i s s a a
- type ACorepn f s t a b = Optic (Costar f) s t a b
- type ACorepn' f t b = ACorepn f t t b b
- type ACxrepn f k s t a b = CoindexedOptic (Costar f) k s t a b
- type ACxrepn' f k t b = ACxrepn f k t t b b
- newtype Re p s t a b = Re {
- runRe :: p b a -> p t s
- re :: Optic (Re p a b) s t a b -> Optic p b a t s
- class (Sieve p (Rep p), Strong p) => Representable (p :: Type -> Type -> Type) where
- class (Cosieve p (Corep p), Costrong p) => Corepresentable (p :: Type -> Type -> Type) where
- class (Profunctor p, Functor f) => Sieve (p :: Type -> Type -> Type) (f :: Type -> Type) | p -> f where
- sieve :: p a b -> a -> f b
- class (Profunctor p, Functor f) => Cosieve (p :: Type -> Type -> Type) (f :: Type -> Type) | p -> f where
- cosieve :: p a b -> f a -> b
- class Profunctor p => Choice (p :: Type -> Type -> Type) where
- class Profunctor p => Cochoice (p :: Type -> Type -> Type) where
- class Profunctor p => Closed (p :: Type -> Type -> Type) where
- closed :: p a b -> p (x -> a) (x -> b)
- class Profunctor p => Strong (p :: Type -> Type -> Type) where
- class Profunctor p => Costrong (p :: Type -> Type -> Type) where
- type (:->) (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) = forall a b. p a b -> q a b
- newtype Star (f :: Type -> Type) d c = Star {
- runStar :: d -> f c
- newtype Costar (f :: Type -> Type) d c = Costar {
- runCostar :: f d -> c
- newtype WrappedArrow (p :: Type -> Type -> Type) a b = WrapArrow {
- unwrapArrow :: p a b
- newtype Forget r a b = Forget {
- runForget :: a -> r
- class Profunctor (p :: Type -> Type -> Type) where
Optics
between :: (c -> d) -> (a -> b) -> (b -> c) -> a -> d Source #
Can be used to rewrite
\g -> f . g . h
to
between f h
type IndexedOptic p i s t a b = p (i, a) b -> p (i, s) t Source #
type IndexedOptic' p i s a = IndexedOptic p i s s a a Source #
type CoindexedOptic p k s t a b = p a (k -> b) -> p s (k -> t) Source #
type CoindexedOptic' p k t b = CoindexedOptic p k t t b b Source #
Equality
Isos
type Iso s t a b = forall p. Profunctor p => Optic p s t a b Source #
Lenses & Colenses
type Lens s t a b = forall p. Strong p => Optic p s t a b Source #
Lenses access one piece of a product.
\( \mathsf{Lens}\;S\;A = \exists C, S \cong C \times A \)
type Ixlens i s t a b = forall p. Strong p => IndexedOptic p i s t a b Source #
type Cxlens k s t a b = forall p. Costrong p => CoindexedOptic p k s t a b Source #
Prisms & Coprisms
type Prism s t a b = forall p. Choice p => Optic p s t a b Source #
Prisms access one piece of a sum.
\( \mathsf{Prism}\;S\;A = \exists D, S \cong D + A \)
type Cxprism k s t a b = forall p. Choice p => CoindexedOptic p k s t a b Source #
type Ixprism i s t a b = forall p. Cochoice p => IndexedOptic p i s t a b Source #
Grates
type Grate s t a b = forall p. Closed p => Optic p s t a b Source #
Grates access the codomain of a function.
\( \mathsf{Grate}\;S\;A = \exists I, S \cong I \to A \)
type Cxgrate k s t a b = forall p. Closed p => CoindexedOptic p k s t a b Source #
Traversals
type Traversal s t a b = forall p. (Choice p, Representable p, Applicative (Rep p)) => Optic p s t a b Source #
A Traversal processes 0 or more parts of the whole, with Applicative interactions.
\( \mathsf{Traversal}\;S\;A = \exists F : \mathsf{Traversable}, S \equiv F\,A \)
type Traversal' s a = Traversal s s a a Source #
type Ixtraversal i s t a b = forall p. (Choice p, Representable p, Applicative (Rep p)) => IndexedOptic p i s t a b Source #
type Ixtraversal' i s a = Ixtraversal i s s a a Source #
Affine traversals & cotraversals
type Traversal0 s t a b = forall p. (Strong p, Choice p) => Optic p s t a b Source #
A Traversal0 processes at most one part of the whole, with no interactions.
\( \mathsf{Traversal0}\;S\;A = \exists C, D, S \cong D + C \times A \)
type Traversal0' s a = Traversal0 s s a a Source #
type Ixtraversal0 i s t a b = forall p. (Strong p, Choice p) => IndexedOptic p i s t a b Source #
type Ixtraversal0' i s a = Ixtraversal0 i s s a a Source #
Non-empty traversals & cotraversals
type Traversal1 s t a b = forall p. (Choice p, Representable p, Apply (Rep p)) => Optic p s t a b Source #
A Traversal1 processes 1 or more parts of the whole, with Apply interactions.
\( \mathsf{Traversal1}\;S\;A = \exists F : \mathsf{Traversable1}, S \equiv F\,A \)
type Traversal1' s a = Traversal1 s s a a Source #
type Cotraversal1 s t a b = forall p. (Closed p, Corepresentable p, Apply (Corep p)) => Optic p s t a b Source #
type Cotraversal1' s a = Cotraversal1 s s a a Source #
type Cxtraversal1 k s t a b = forall p. (Closed p, Corepresentable p, Apply (Corep p)) => CoindexedOptic p k s t a b Source #
type Cxtraversal1' k s a = Cxtraversal1 k s s a a Source #
Affine folds, general & non-empty folds, & cofolds
type Fold0 s a = forall p. (Choice p, Representable p, Applicative (Rep p), forall x. Contravariant (p x)) => Optic' p s a Source #
A Fold0 combines at most one element, with no interactions.
type Ixfold0 i s a = forall p. (Choice p, Strong p, forall x. Contravariant (p x)) => IndexedOptic' p i s a Source #
type Fold s a = forall p. (Choice p, Representable p, Applicative (Rep p), forall x. Contravariant (p x)) => Optic' p s a Source #
type Ixfold i s a = forall p. (Choice p, Representable p, Applicative (Rep p), forall x. Contravariant (p x)) => IndexedOptic' p i s a Source #
type Fold1 s a = forall p. (Choice p, Representable p, Apply (Rep p), forall x. Contravariant (p x)) => Optic p s s a a Source #
type Cofold1 t b = forall p. (Cochoice p, Corepresentable p, Apply (Corep p), Bifunctor p) => Optic p t t b b Source #
Views & Reviews
type PrimView s t a b = forall p. (Profunctor p, forall x. Contravariant (p x)) => Optic p s t a b Source #
type Ixview i s a = forall p. (Strong p, forall x. Contravariant (p x)) => IndexedOptic' p i s a Source #
type PrimReview s t a b = forall p. (Profunctor p, Bifunctor p) => Optic p s t a b Source #
Setters & Resetters
type Setter s t a b = forall p. (Closed p, Choice p, Representable p, Applicative (Rep p), Distributive (Rep p)) => Optic p s t a b Source #
A Setter modifies part of a structure.
\( \mathsf{Setter}\;S\;A = \exists F : \mathsf{Functor}, S \equiv F\,A \)
type Ixsetter i s t a b = forall p. (Closed p, Choice p, Representable p, Applicative (Rep p), Distributive (Rep p)) => IndexedOptic p i s t a b Source #
type Resetter s t a b = forall p. (Closed p, Cochoice p, Corepresentable p, Apply (Corep p), Traversable (Corep p)) => Optic p s t a b Source #
type Cxsetter k s t a b = forall p. (Closed p, Cochoice p, Corepresentable p, Apply (Corep p), Traversable (Corep p)) => CoindexedOptic p k s t a b Source #
Common represenable and corepresentable carriers
type AIxrepn f i s t a b = IndexedOptic (Star f) i s t a b Source #
type ACxrepn f k s t a b = CoindexedOptic (Costar f) k s t a b Source #
Re
The Re type and its instances witness the symmetry between the parameters of a Profunctor.
Instances
| (Profunctor p, forall x. Contravariant (p x)) => Bifunctor (Re p s t) Source # | |
| Cochoice p => Choice (Re p s t) Source # | |
| Choice p => Cochoice (Re p s t) Source # | |
| Costrong p => Strong (Re p s t) Source # | |
| Strong p => Costrong (Re p s t) Source # | |
| Profunctor p => Profunctor (Re p s t) Source # | |
Defined in Data.Profunctor.Optic.Type | |
| Bifunctor p => Contravariant (Re p s t a) Source # | |
class (Sieve p (Rep p), Strong p) => Representable (p :: Type -> Type -> Type) where #
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) | |
| Functor f => Representable (Star f) | |
| Representable (Forget r) | |
| Representable (Fold0Rep r) Source # | |
| Representable ((->) :: Type -> Type -> Type) | |
| Representable (LensRep a b) Source # | |
| Representable (Traversal0Rep a b) Source # | |
Defined in Data.Profunctor.Optic.Traversal0 Associated Types type Rep (Traversal0Rep a b) :: Type -> Type # Methods tabulate :: (d -> Rep (Traversal0Rep a b) c) -> Traversal0Rep a b d c # | |
class (Cosieve p (Corep p), Costrong p) => Corepresentable (p :: Type -> Type -> Type) where #
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 #
Laws:
cotabulate.cosieve≡idcosieve.cotabulate≡id
Instances
| Functor f => Corepresentable (Costar f) | |
| Corepresentable (Tagged :: Type -> Type -> Type) | |
| Corepresentable ((->) :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Rep Methods cotabulate :: (Corep (->) d -> c) -> d -> c # | |
| Functor w => Corepresentable (Cokleisli w) | |
| Corepresentable (GrateRep a b) Source # | |
class (Profunctor p, Functor f) => Sieve (p :: Type -> Type -> Type) (f :: Type -> Type) | p -> f where #
A Profunctor p is a Sieve on f if it is a subprofunctor of .Star f
That is to say it is a subset of Hom(-,f=) closed under lmap and rmap.
Alternately, you can view it as a sieve in the comma category Hask/f.
Instances
| (Monad m, Functor m) => Sieve (Kleisli m) m | |
Defined in Data.Profunctor.Sieve | |
| Functor f => Sieve (Star f) f | |
Defined in Data.Profunctor.Sieve | |
| Sieve (Fold0Rep r) (Pre r) Source # | |
Defined in Data.Profunctor.Optic.Fold0 | |
| Sieve (Forget r) (Const r :: Type -> Type) | |
Defined in Data.Profunctor.Sieve | |
| Sieve ((->) :: Type -> Type -> Type) Identity | |
Defined in Data.Profunctor.Sieve | |
| Sieve (IsoRep a b) (Index a b) Source # | |
Defined in Data.Profunctor.Optic.Iso | |
| Sieve (LensRep a b) (Index a b) Source # | |
Defined in Data.Profunctor.Optic.Lens | |
class (Profunctor p, Functor f) => Cosieve (p :: Type -> Type -> Type) (f :: Type -> Type) | p -> f where #
A Profunctor p is a Cosieve on f if it is a subprofunctor of .Costar f
That is to say it is a subset of Hom(f-,=) closed under lmap and rmap.
Alternately, you can view it as a cosieve in the comma category f/Hask.
Instances
| Functor f => Cosieve (Costar f) f | |
Defined in Data.Profunctor.Sieve | |
| Cosieve (Tagged :: Type -> Type -> Type) (Proxy :: Type -> Type) | |
Defined in Data.Profunctor.Sieve | |
| Cosieve ((->) :: Type -> Type -> Type) Identity | |
Defined in Data.Profunctor.Sieve | |
| Functor w => Cosieve (Cokleisli w) w | |
Defined in Data.Profunctor.Sieve | |
| Cosieve (IsoRep a b) (Coindex a b) Source # | |
Defined in Data.Profunctor.Optic.Iso | |
| Cosieve (GrateRep a b) (Coindex a b) Source # | |
Defined in Data.Profunctor.Optic.Grate | |
class Profunctor p => Choice (p :: Type -> Type -> Type) where #
The generalization of Costar of Functor that is strong with respect
to Either.
Note: This is also a notion of strength, except with regards to another monoidal structure that we can choose to equip Hask with: the cocartesian coproduct.
Methods
left' :: p a b -> p (Either a c) (Either b c) #
Laws:
left'≡dimapswapE swapE.right'where swapE ::Eithera b ->Eitherb a swapE =eitherRightLeftrmapLeft≡lmapLeft.left'lmap(rightf).left'≡rmap(rightf).left'left'.left'≡dimapassocE unassocE.left'where assocE ::Either(Eithera b) c ->Eithera (Eitherb c) assocE (Left(Lefta)) =Lefta assocE (Left(Rightb)) =Right(Leftb) assocE (Rightc) =Right(Rightc) unassocE ::Eithera (Eitherb c) ->Either(Eithera b) c unassocE (Lefta) =Left(Lefta) unassocE (Right(Leftb) =Left(Rightb) unassocE (Right(Rightc)) =Rightc)
right' :: p a b -> p (Either c a) (Either c b) #
Laws:
right'≡dimapswapE swapE.left'where swapE ::Eithera b ->Eitherb a swapE =eitherRightLeftrmapRight≡lmapRight.right'lmap(leftf).right'≡rmap(leftf).right'right'.right'≡dimapunassocE assocE.right'where assocE ::Either(Eithera b) c ->Eithera (Eitherb c) assocE (Left(Lefta)) =Lefta assocE (Left(Rightb)) =Right(Leftb) assocE (Rightc) =Right(Rightc) unassocE ::Eithera (Eitherb c) ->Either(Eithera b) c unassocE (Lefta) =Left(Lefta) unassocE (Right(Leftb) =Left(Rightb) unassocE (Right(Rightc)) =Rightc)
Instances
class Profunctor p => Cochoice (p :: Type -> Type -> Type) where #
Methods
unleft :: p (Either a d) (Either b d) -> p a b #
Laws:
unleft≡unright.dimapswapE swapE where swapE ::Eithera b ->Eitherb a swapE =eitherRightLeftrmap(eitheridabsurd) ≡unleft.lmap(eitheridabsurd)unfirst.rmap(secondf) ≡unfirst.lmap(secondf)unleft.unleft≡unleft.dimapassocE unassocE where assocE ::Either(Eithera b) c ->Eithera (Eitherb c) assocE (Left(Lefta)) =Lefta assocE (Left(Rightb)) =Right(Leftb) assocE (Rightc) =Right(Rightc) unassocE ::Eithera (Eitherb c) ->Either(Eithera b) c unassocE (Lefta) =Left(Lefta) unassocE (Right(Leftb) =Left(Rightb) unassocE (Right(Rightc)) =Rightc)
unright :: p (Either d a) (Either d b) -> p a b #
Laws:
unright≡unleft.dimapswapE swapE where swapE ::Eithera b ->Eitherb a swapE =eitherRightLeftrmap(eitherabsurdid) ≡unright.lmap(eitherabsurdid)unsecond.rmap(firstf) ≡unsecond.lmap(firstf)unright.unright≡unright.dimapunassocE assocE where assocE ::Either(Eithera b) c ->Eithera (Eitherb c) assocE (Left(Lefta)) =Lefta assocE (Left(Rightb)) =Right(Leftb) assocE (Rightc) =Right(Rightc) unassocE ::Eithera (Eitherb c) ->Either(Eithera b) c unassocE (Lefta) =Left(Lefta) unassocE (Right(Leftb) =Left(Rightb) unassocE (Right(Rightc)) =Rightc)
Instances
class Profunctor p => Closed (p :: Type -> Type -> Type) where #
A strong profunctor allows the monoidal structure to pass through.
A closed profunctor allows the closed structure to pass through.
Methods
Instances
| (Distributive f, Monad f) => Closed (Kleisli f) | |
Defined in Data.Profunctor.Closed | |
| Closed (Environment p) | |
Defined in Data.Profunctor.Closed Methods closed :: Environment p a b -> Environment p (x -> a) (x -> b) # | |
| Closed p => Closed (Coyoneda p) | |
Defined in Data.Profunctor.Yoneda | |
| Closed p => Closed (Yoneda p) | |
Defined in Data.Profunctor.Yoneda | |
| Profunctor p => Closed (Closure p) | |
Defined in Data.Profunctor.Closed | |
| Distributive f => Closed (Star f) | |
Defined in Data.Profunctor.Closed | |
| Functor f => Closed (Costar f) | |
Defined in Data.Profunctor.Closed | |
| Closed (Tagged :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Closed | |
| Closed ((->) :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Closed | |
| Functor f => Closed (Cokleisli f) | |
Defined in Data.Profunctor.Closed | |
| Closed (GrateRep a b) Source # | |
Defined in Data.Profunctor.Optic.Grate | |
| (Closed p, Closed q) => Closed (Product p q) | |
Defined in Data.Profunctor.Closed | |
| (Functor f, Closed p) => Closed (Tannen f p) | |
Defined in Data.Profunctor.Closed | |
class Profunctor p => Strong (p :: Type -> Type -> Type) where #
Generalizing Star of a strong Functor
Note: Every Functor in Haskell is strong with respect to (,).
This describes profunctor strength with respect to the product structure of Hask.
http://www-kb.is.s.u-tokyo.ac.jp/~asada/papers/arrStrMnd.pdf
Methods
Instances
class Profunctor p => Costrong (p :: Type -> Type -> Type) where #
Methods
Instances
| MonadFix m => Costrong (Kleisli m) | |
| Costrong p => Costrong (Coyoneda p) | |
| Costrong p => Costrong (Yoneda p) | |
| Costrong (Cotambara p) | |
| Costrong (Copastro p) | |
| Functor f => Costrong (Costar f) | |
| ArrowLoop p => Costrong (WrappedArrow p) | |
Defined in Data.Profunctor.Strong Methods unfirst :: WrappedArrow p (a, d) (b, d) -> WrappedArrow p a b # unsecond :: WrappedArrow p (d, a) (d, b) -> WrappedArrow p a b # | |
| Costrong (Tagged :: Type -> Type -> Type) | |
| Costrong ((->) :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Strong | |
| Functor f => Costrong (Cokleisli f) | |
| Costrong (GrateRep a b) Source # | |
| Strong p => Costrong (Re p s t) Source # | |
| (Costrong p, Costrong q) => Costrong (Product p q) | |
| (Functor f, Costrong p) => Costrong (Tannen f p) | |
type (:->) (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) = forall a b. p a b -> q a b infixr 0 #
newtype Star (f :: Type -> Type) d c #
Lift a Functor into a Profunctor (forwards).
Instances
| Functor f => Representable (Star f) | |
| Applicative f => Choice (Star f) | |
| Traversable f => Cochoice (Star f) | |
| Distributive f => Closed (Star f) | |
Defined in Data.Profunctor.Closed | |
| Functor m => Strong (Star m) | |
| Functor f => Profunctor (Star f) | |
Defined in Data.Profunctor.Types | |
| Functor f => Sieve (Star f) f | |
Defined in Data.Profunctor.Sieve | |
| Monad f => Category (Star f :: Type -> Type -> Type) | |
| Monad f => Monad (Star f a) | |
| Functor f => Functor (Star f a) | |
| Applicative f => Applicative (Star f a) | |
| Contravariant f => Contravariant (Star f a) Source # | |
| Alternative f => Alternative (Star f a) | |
| MonadPlus f => MonadPlus (Star f a) | |
| Distributive f => Distributive (Star f a) | |
Defined in Data.Profunctor.Types | |
| Apply f => Apply (Star f a) Source # | |
| type Rep (Star f) | |
Defined in Data.Profunctor.Rep | |
newtype Costar (f :: Type -> Type) d c #
Lift a Functor into a Profunctor (backwards).
Instances
| Contravariant f => Bifunctor (Costar f) Source # | |
| Functor f => Corepresentable (Costar f) | |
| Traversable w => Choice (Costar w) | |
| Applicative f => Cochoice (Costar f) | |
| Functor f => Closed (Costar f) | |
Defined in Data.Profunctor.Closed | |
| Comonad f => Strong (Costar f) Source # | |
| Functor f => Costrong (Costar f) | |
| Functor f => Profunctor (Costar f) | |
Defined in Data.Profunctor.Types | |
| Functor f => Cosieve (Costar f) f | |
Defined in Data.Profunctor.Sieve | |
| Monad (Costar f a) | |
| Functor (Costar f a) | |
| Applicative (Costar f a) | |
Defined in Data.Profunctor.Types | |
| Distributive (Costar f d) | |
Defined in Data.Profunctor.Types | |
| type Corep (Costar f) | |
Defined in Data.Profunctor.Rep | |
newtype WrappedArrow (p :: Type -> Type -> Type) a b #
Wrap an arrow for use as a Profunctor.
Constructors
| WrapArrow | |
Fields
| |
Instances
Instances
| Representable (Forget r) | |
| Monoid r => Choice (Forget r) | |
| Cochoice (Forget r) Source # | |
| Strong (Forget r) | |
| Profunctor (Forget r) | |
Defined in Data.Profunctor.Types | |
| Sieve (Forget r) (Const r :: Type -> Type) | |
Defined in Data.Profunctor.Sieve | |
| Functor (Forget r a) | |
| Foldable (Forget r a) | |
Defined in Data.Profunctor.Types Methods fold :: Monoid m => Forget r a m -> m # foldMap :: Monoid m => (a0 -> m) -> Forget r a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Forget r a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Forget r a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Forget r a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Forget r a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Forget r a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Forget r a a0 -> a0 # toList :: Forget r a a0 -> [a0] # null :: Forget r a a0 -> Bool # length :: Forget r a a0 -> Int # elem :: Eq a0 => a0 -> Forget r a a0 -> Bool # maximum :: Ord a0 => Forget r a a0 -> a0 # minimum :: Ord a0 => Forget r a a0 -> a0 # | |
| Traversable (Forget r a) | |
Defined in Data.Profunctor.Types | |
| type Rep (Forget r) | |
class Profunctor (p :: Type -> Type -> Type) where #
Formally, the class Profunctor represents a profunctor
from Hask -> Hask.
Intuitively it is a bifunctor where the first argument is contravariant and the second argument is covariant.
You can define a Profunctor by either defining dimap or by defining both
lmap and rmap.
If you supply dimap, you should ensure that:
dimapidid≡id
If you supply lmap and rmap, ensure:
lmapid≡idrmapid≡id
If you supply both, you should also ensure:
dimapf g ≡lmapf.rmapg
These ensure by parametricity:
dimap(f.g) (h.i) ≡dimapg h.dimapf ilmap(f.g) ≡lmapg.lmapfrmap(f.g) ≡rmapf.rmapg
Instances
| Monad m => Profunctor (Kleisli m) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Kleisli m b c -> Kleisli m a d # lmap :: (a -> b) -> Kleisli m b c -> Kleisli m a c # rmap :: (b -> c) -> Kleisli m a b -> Kleisli m a c # (#.) :: Coercible c b => q b c -> Kleisli m a b -> Kleisli m a c # (.#) :: Coercible b a => Kleisli m b c -> q a b -> Kleisli m a c # | |
| Profunctor (Pastro p) | |
Defined in Data.Profunctor.Strong | |
| Profunctor (Environment p) | |
Defined in Data.Profunctor.Closed Methods dimap :: (a -> b) -> (c -> d) -> Environment p b c -> Environment p a d # lmap :: (a -> b) -> Environment p b c -> Environment p a c # rmap :: (b -> c) -> Environment p a b -> Environment p a c # (#.) :: Coercible c b => q b c -> Environment p a b -> Environment p a c # (.#) :: Coercible b a => Environment p b c -> q a b -> Environment p a c # | |
| Profunctor (PastroSum p) | |
Defined in Data.Profunctor.Choice Methods dimap :: (a -> b) -> (c -> d) -> PastroSum p b c -> PastroSum p a d # lmap :: (a -> b) -> PastroSum p b c -> PastroSum p a c # rmap :: (b -> c) -> PastroSum p a b -> PastroSum p a c # (#.) :: Coercible c b => q b c -> PastroSum p a b -> PastroSum p a c # (.#) :: Coercible b a => PastroSum p b c -> q a b -> PastroSum p a c # | |
| Profunctor (Coyoneda p) | |
Defined in Data.Profunctor.Yoneda Methods dimap :: (a -> b) -> (c -> d) -> Coyoneda p b c -> Coyoneda p a d # lmap :: (a -> b) -> Coyoneda p b c -> Coyoneda p a c # rmap :: (b -> c) -> Coyoneda p a b -> Coyoneda p a c # (#.) :: Coercible c b => q b c -> Coyoneda p a b -> Coyoneda p a c # (.#) :: Coercible b a => Coyoneda p b c -> q a b -> Coyoneda p a c # | |
| Profunctor (Yoneda p) | |
Defined in Data.Profunctor.Yoneda | |
| Profunctor p => Profunctor (TambaraSum p) | |
Defined in Data.Profunctor.Choice Methods dimap :: (a -> b) -> (c -> d) -> TambaraSum p b c -> TambaraSum p a d # lmap :: (a -> b) -> TambaraSum p b c -> TambaraSum p a c # rmap :: (b -> c) -> TambaraSum p a b -> TambaraSum p a c # (#.) :: Coercible c b => q b c -> TambaraSum p a b -> TambaraSum p a c # (.#) :: Coercible b a => TambaraSum p b c -> q a b -> TambaraSum p a c # | |
| Profunctor (CotambaraSum p) | |
Defined in Data.Profunctor.Choice Methods dimap :: (a -> b) -> (c -> d) -> CotambaraSum p b c -> CotambaraSum p a d # lmap :: (a -> b) -> CotambaraSum p b c -> CotambaraSum p a c # rmap :: (b -> c) -> CotambaraSum p a b -> CotambaraSum p a c # (#.) :: Coercible c b => q b c -> CotambaraSum p a b -> CotambaraSum p a c # (.#) :: Coercible b a => CotambaraSum p b c -> q a b -> CotambaraSum p a c # | |
| Profunctor (CopastroSum p) | |
Defined in Data.Profunctor.Choice Methods dimap :: (a -> b) -> (c -> d) -> CopastroSum p b c -> CopastroSum p a d # lmap :: (a -> b) -> CopastroSum p b c -> CopastroSum p a c # rmap :: (b -> c) -> CopastroSum p a b -> CopastroSum p a c # (#.) :: Coercible c b => q b c -> CopastroSum p a b -> CopastroSum p a c # (.#) :: Coercible b a => CopastroSum p b c -> q a b -> CopastroSum p a c # | |
| Profunctor p => Profunctor (Closure p) | |
Defined in Data.Profunctor.Closed Methods dimap :: (a -> b) -> (c -> d) -> Closure p b c -> Closure p a d # lmap :: (a -> b) -> Closure p b c -> Closure p a c # rmap :: (b -> c) -> Closure p a b -> Closure p a c # (#.) :: Coercible c b => q b c -> Closure p a b -> Closure p a c # (.#) :: Coercible b a => Closure p b c -> q a b -> Closure p a c # | |
| Profunctor p => Profunctor (Tambara p) | |
Defined in Data.Profunctor.Strong Methods dimap :: (a -> b) -> (c -> d) -> Tambara p b c -> Tambara p a d # lmap :: (a -> b) -> Tambara p b c -> Tambara p a c # rmap :: (b -> c) -> Tambara p a b -> Tambara p a c # (#.) :: Coercible c b => q b c -> Tambara p a b -> Tambara p a c # (.#) :: Coercible b a => Tambara p b c -> q a b -> Tambara p a c # | |
| Profunctor (Cotambara p) | |
Defined in Data.Profunctor.Strong Methods dimap :: (a -> b) -> (c -> d) -> Cotambara p b c -> Cotambara p a d # lmap :: (a -> b) -> Cotambara p b c -> Cotambara p a c # rmap :: (b -> c) -> Cotambara p a b -> Cotambara p a c # (#.) :: Coercible c b => q b c -> Cotambara p a b -> Cotambara p a c # (.#) :: Coercible b a => Cotambara p b c -> q a b -> Cotambara p a c # | |
| Profunctor (Copastro p) | |
Defined in Data.Profunctor.Strong Methods dimap :: (a -> b) -> (c -> d) -> Copastro p b c -> Copastro p a d # lmap :: (a -> b) -> Copastro p b c -> Copastro p a c # rmap :: (b -> c) -> Copastro p a b -> Copastro p a c # (#.) :: Coercible c b => q b c -> Copastro p a b -> Copastro p a c # (.#) :: Coercible b a => Copastro p b c -> q a b -> Copastro p a c # | |
| Functor f => Profunctor (Star f) | |
Defined in Data.Profunctor.Types | |
| Functor f => Profunctor (Costar f) | |
Defined in Data.Profunctor.Types | |
| Arrow p => Profunctor (WrappedArrow p) | |
Defined in Data.Profunctor.Types Methods dimap :: (a -> b) -> (c -> d) -> WrappedArrow p b c -> WrappedArrow p a d # lmap :: (a -> b) -> WrappedArrow p b c -> WrappedArrow p a c # rmap :: (b -> c) -> WrappedArrow p a b -> WrappedArrow p a c # (#.) :: Coercible c b => q b c -> WrappedArrow p a b -> WrappedArrow p a c # (.#) :: Coercible b a => WrappedArrow p b c -> q a b -> WrappedArrow p a c # | |
| Profunctor (Forget r) | |
Defined in Data.Profunctor.Types | |
| Profunctor (Tagged :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe | |
| Profunctor (Index a) Source # | |
Defined in Data.Profunctor.Optic.Index | |
| Profunctor (Fold0Rep r) Source # | |
Defined in Data.Profunctor.Optic.Fold0 Methods dimap :: (a -> b) -> (c -> d) -> Fold0Rep r b c -> Fold0Rep r a d # lmap :: (a -> b) -> Fold0Rep r b c -> Fold0Rep r a c # rmap :: (b -> c) -> Fold0Rep r a b -> Fold0Rep r a c # (#.) :: Coercible c b => q b c -> Fold0Rep r a b -> Fold0Rep r a c # (.#) :: Coercible b a => Fold0Rep r b c -> q a b -> Fold0Rep r a c # | |
| Profunctor ((->) :: Type -> Type -> Type) | |
| Functor w => Profunctor (Cokleisli w) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Cokleisli w b c -> Cokleisli w a d # lmap :: (a -> b) -> Cokleisli w b c -> Cokleisli w a c # rmap :: (b -> c) -> Cokleisli w a b -> Cokleisli w a c # (#.) :: Coercible c b => q b c -> Cokleisli w a b -> Cokleisli w a c # (.#) :: Coercible b a => Cokleisli w b c -> q a b -> Cokleisli w a c # | |
| Profunctor (IsoRep a b) Source # | |
Defined in Data.Profunctor.Optic.Iso Methods dimap :: (a0 -> b0) -> (c -> d) -> IsoRep a b b0 c -> IsoRep a b a0 d # lmap :: (a0 -> b0) -> IsoRep a b b0 c -> IsoRep a b a0 c # rmap :: (b0 -> c) -> IsoRep a b a0 b0 -> IsoRep a b a0 c # (#.) :: Coercible c b0 => q b0 c -> IsoRep a b a0 b0 -> IsoRep a b a0 c # (.#) :: Coercible b0 a0 => IsoRep a b b0 c -> q a0 b0 -> IsoRep a b a0 c # | |
| Profunctor (CoprismRep a b) Source # | |
Defined in Data.Profunctor.Optic.Prism Methods dimap :: (a0 -> b0) -> (c -> d) -> CoprismRep a b b0 c -> CoprismRep a b a0 d # lmap :: (a0 -> b0) -> CoprismRep a b b0 c -> CoprismRep a b a0 c # rmap :: (b0 -> c) -> CoprismRep a b a0 b0 -> CoprismRep a b a0 c # (#.) :: Coercible c b0 => q b0 c -> CoprismRep a b a0 b0 -> CoprismRep a b a0 c # (.#) :: Coercible b0 a0 => CoprismRep a b b0 c -> q a0 b0 -> CoprismRep a b a0 c # | |
| Profunctor (PrismRep a b) Source # | |
Defined in Data.Profunctor.Optic.Prism Methods dimap :: (a0 -> b0) -> (c -> d) -> PrismRep a b b0 c -> PrismRep a b a0 d # lmap :: (a0 -> b0) -> PrismRep a b b0 c -> PrismRep a b a0 c # rmap :: (b0 -> c) -> PrismRep a b a0 b0 -> PrismRep a b a0 c # (#.) :: Coercible c b0 => q b0 c -> PrismRep a b a0 b0 -> PrismRep a b a0 c # (.#) :: Coercible b0 a0 => PrismRep a b b0 c -> q a0 b0 -> PrismRep a b a0 c # | |
| Profunctor (LensRep a b) Source # | |
Defined in Data.Profunctor.Optic.Lens Methods dimap :: (a0 -> b0) -> (c -> d) -> LensRep a b b0 c -> LensRep a b a0 d # lmap :: (a0 -> b0) -> LensRep a b b0 c -> LensRep a b a0 c # rmap :: (b0 -> c) -> LensRep a b a0 b0 -> LensRep a b a0 c # (#.) :: Coercible c b0 => q b0 c -> LensRep a b a0 b0 -> LensRep a b a0 c # (.#) :: Coercible b0 a0 => LensRep a b b0 c -> q a0 b0 -> LensRep a b a0 c # | |
| Profunctor (GrateRep a b) Source # | |
Defined in Data.Profunctor.Optic.Grate Methods dimap :: (a0 -> b0) -> (c -> d) -> GrateRep a b b0 c -> GrateRep a b a0 d # lmap :: (a0 -> b0) -> GrateRep a b b0 c -> GrateRep a b a0 c # rmap :: (b0 -> c) -> GrateRep a b a0 b0 -> GrateRep a b a0 c # (#.) :: Coercible c b0 => q b0 c -> GrateRep a b a0 b0 -> GrateRep a b a0 c # (.#) :: Coercible b0 a0 => GrateRep a b b0 c -> q a0 b0 -> GrateRep a b a0 c # | |
| Profunctor (Traversal0Rep u v) Source # | |
Defined in Data.Profunctor.Optic.Traversal0 Methods dimap :: (a -> b) -> (c -> d) -> Traversal0Rep u v b c -> Traversal0Rep u v a d # lmap :: (a -> b) -> Traversal0Rep u v b c -> Traversal0Rep u v a c # rmap :: (b -> c) -> Traversal0Rep u v a b -> Traversal0Rep u v a c # (#.) :: Coercible c b => q b c -> Traversal0Rep u v a b -> Traversal0Rep u v a c # (.#) :: Coercible b a => Traversal0Rep u v b c -> q a b -> Traversal0Rep u v a c # | |
| Functor f => Profunctor (Joker f :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe | |
| Contravariant f => Profunctor (Clown f :: Type -> Type -> Type) | |
Defined in Data.Profunctor.Unsafe | |
| Profunctor p => Profunctor (Re p s t) Source # | |
Defined in Data.Profunctor.Optic.Type | |
| Profunctor (IxlensRep i a b) Source # | |
Defined in Data.Profunctor.Optic.Lens Methods dimap :: (a0 -> b0) -> (c -> d) -> IxlensRep i a b b0 c -> IxlensRep i a b a0 d # lmap :: (a0 -> b0) -> IxlensRep i a b b0 c -> IxlensRep i a b a0 c # rmap :: (b0 -> c) -> IxlensRep i a b a0 b0 -> IxlensRep i a b a0 c # (#.) :: Coercible c b0 => q b0 c -> IxlensRep i a b a0 b0 -> IxlensRep i a b a0 c # (.#) :: Coercible b0 a0 => IxlensRep i a b b0 c -> q a0 b0 -> IxlensRep i a b a0 c # | |
| (Profunctor p, Profunctor q) => Profunctor (Sum p q) | |
Defined in Data.Profunctor.Unsafe | |
| (Profunctor p, Profunctor q) => Profunctor (Product p q) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Product p q b c -> Product p q a d # lmap :: (a -> b) -> Product p q b c -> Product p q a c # rmap :: (b -> c) -> Product p q a b -> Product p q a c # (#.) :: Coercible c b => q0 b c -> Product p q a b -> Product p q a c # (.#) :: Coercible b a => Product p q b c -> q0 a b -> Product p q a c # | |
| (Functor f, Profunctor p) => Profunctor (Tannen f p) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Tannen f p b c -> Tannen f p a d # lmap :: (a -> b) -> Tannen f p b c -> Tannen f p a c # rmap :: (b -> c) -> Tannen f p a b -> Tannen f p a c # (#.) :: Coercible c b => q b c -> Tannen f p a b -> Tannen f p a c # (.#) :: Coercible b a => Tannen f p b c -> q a b -> Tannen f p a c # | |
| (Profunctor p, Functor f, Functor g) => Profunctor (Biff p f g) | |
Defined in Data.Profunctor.Unsafe Methods dimap :: (a -> b) -> (c -> d) -> Biff p f g b c -> Biff p f g a d # lmap :: (a -> b) -> Biff p f g b c -> Biff p f g a c # rmap :: (b -> c) -> Biff p f g a b -> Biff p f g a c # (#.) :: Coercible c b => q b c -> Biff p f g a b -> Biff p f g a c # (.#) :: Coercible b a => Biff p f g b c -> q a b -> Biff p f g a c # | |