HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulerebase-1.21.2Haskell2010

Rebase.Data.Profunctor

  • 5 types
  • 7 classes
  • 2 values
  • Packagerebase-1.21.2
  • Exports14
  • LanguageHaskell2010
  • LicenceMIT
  • SourceUnsafe.hs
classclass 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:

dimap id id ≡ id

If you supply lmap and rmap, ensure:

lmap id ≡ id
rmap id ≡ id

If you supply both, you should also ensure:

dimap f g ≡ lmap f . rmap g

These ensure by parametricity:

dimap (f . g) (h . i) ≡ dimap g h . dimap f i
lmap (f . g) ≡ lmap g . lmap f
rmap (f . g) ≡ rmap f . rmap g

Methods

  • dimap :: (a -> b) -> (c -> d) -> p b c -> p a d

    Map over both arguments at the same time.

    dimap f g ≡ lmap f . rmap g
  • lmap :: (a -> b) -> p b c -> p a c

    Map the first argument contravariantly.

    lmap f ≡ dimap f id
  • rmap :: (b -> c) -> p a b -> p a c

    Map the second argument covariantly.

    rmap ≡ dimap id
Instances38Profunctor, …
classclass 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

Instances23Choice, …
classclass 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

Instances18Closed, …
classclass (Traversing p, Closed p) => Mapping (p :: Type -> Type -> Type) where
#

Methods

Instances11Mapping, …
classclass 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.riec.tohoku.ac.jp/~asada/papers/arrStrMnd.pdf

Methods

Instances21Strong, …
newtypenewtype WrappedArrow (p :: k -> k1 -> Type) (a :: k) (b :: k1)
#

Wrap an arrow for use as a Profunctor.

WrappedArrow has a polymorphic kind since 5.6.

Constructors

Instances12Category, Arrow, ArrowApply, ArrowChoice, ArrowLoop, ArrowZero, …
typetype (:->) (p :: k -> k1 -> Type) (q :: k -> k1 -> Type) = forall (a :: k) (b :: k1). p a b -> q a b
#

(:->) has a polymorphic kind since 5.6.

classclass Profunctor p => Cochoice (p :: Type -> Type -> Type) where
#

Methods

Instances13Cochoice, …
classclass Profunctor p => Costrong (p :: Type -> Type -> Type) where
#

Analogous to ArrowLoop, loop = unfirst

Methods

Instances16Costrong, …
newtypenewtype Costar (f :: k -> Type) (d :: k) c
#

Lift a Functor into a Profunctor (backwards).

Costar has a polymorphic kind since 5.6.

Constructors

Instances13Cochoice, Closed, Costrong, Profunctor, Corepresentable, Invariant2, …
newtypenewtype Forget r a (b :: k)
#

Forget has a polymorphic kind since 5.6.

Constructors

Instances16Choice, Cochoice, Strong, Profunctor, Traversing, Representable, …
  • Monoid r => Choice (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.Choice
  • Cochoice (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.Choice
  • Strong (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.Strong
  • Profunctor (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.Types
  • Monoid m => Traversing (Forget m)Defined in profunctors-5.6.3 · Data.Profunctor.Traversing
  • Representable (Forget r)Defined in profunctors-5.6.3 · Data.Profunctor.Rep
  • Invariant2 (Forget r)Defined in invariant-0.6.4 · Data.Functor.Invariant

    from the profunctors package

  • Sieve (Forget r) (Const r)Defined in profunctors-5.6.3 · Data.Profunctor.Sieve
  • Functor (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.Types
  • Foldable (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.Types
  • Traversable (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.Types
  • Contravariant (Forget r a)Defined in profunctors-5.6.3 · Data.Profunctor.Types
  • Invariant (Forget r a)Defined in invariant-0.6.4 · Data.Functor.Invariant

    from the profunctors package

  • Semigroup r => Semigroup (Forget r a b)Defined in profunctors-5.6.3 · Data.Profunctor.Types

    Via Semigroup r => (a -> r)

  • Monoid r => Monoid (Forget r a b)Defined in profunctors-5.6.3 · Data.Profunctor.Types

    Via Monoid r => (a -> r)

  • type Rep (Forget r) = Const rDefined in profunctors-5.6.3 · Data.Profunctor.Rep
newtypenewtype Star (f :: k -> Type) d (c :: k)
#

Lift a Functor into a Profunctor (forwards).

Star has a polymorphic kind since 5.6.

Constructors

Instances20Category, Choice, Cochoice, Closed, Mapping, Strong, …