profunctors-5.2: Profunctors

Copyright | (C) 2014-2015 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | Rank2Types
Safe Haskell | None
Language | Haskell2010

Data.Profunctor.Strong

Contents

- Strength
- Costrength

Description

Synopsis

- class Profunctor p => Strong p where
- uncurry' :: Strong p => p a (b -> c) -> p (a, b) c
- newtype Tambara p a b = Tambara {
  - runTambara :: forall c. p (a, c) (b, c)
  }
- tambara :: Strong p => (p :-> q) -> p :-> Tambara q
- untambara :: Profunctor q => (p :-> Tambara q) -> p :-> q
- data Pastro p a b where
  - Pastro :: ((y, z) -> b) -> p x y -> (a -> (x, z)) -> Pastro p a b
- class Profunctor p => Costrong p where
- data Cotambara q a b where
  - Cotambara :: Costrong r => (r :-> q) -> r a b -> Cotambara q a b
- cotambara :: Costrong p => (p :-> q) -> p :-> Cotambara q
- uncotambara :: Profunctor q => (p :-> Cotambara q) -> p :-> q
- newtype Copastro p a b = Copastro {
  - runCopastro :: forall r. Costrong r => (forall x y. p x y -> r x y) -> r a b
  }

# Strength

class Profunctor p => Strong p 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

Minimal complete definition

first' | second'

Methods

first' :: p a b -> p (a, c) (b, c) #

second' :: p a b -> p (c, a) (c, b) #

Instances

Strong (->) # |
Methods first' :: (a -> b) -> (a, c) -> (b, c) # second' :: (a -> b) -> (c, a) -> (c, b) #
Monad m => Strong (Kleisli m) # |
Methods first' :: Kleisli m a b -> Kleisli m (a, c) (b, c) # second' :: Kleisli m a b -> Kleisli m (c, a) (c, b) #
Strong (Forget r) # |
Methods first' :: Forget r a b -> Forget r (a, c) (b, c) # second' :: Forget r a b -> Forget r (c, a) (c, b) #
Arrow p => Strong (WrappedArrow p) # | `Arrow` is `Strong` `Category`
Methods first' :: WrappedArrow p a b -> WrappedArrow p (a, c) (b, c) # second' :: WrappedArrow p a b -> WrappedArrow p (c, a) (c, b) #
Functor m => Strong (Star m) # |
Methods first' :: Star m a b -> Star m (a, c) (b, c) # second' :: Star m a b -> Star m (c, a) (c, b) #
Strong (Pastro p) # |
Methods first' :: Pastro p a b -> Pastro p (a, c) (b, c) # second' :: Pastro p a b -> Pastro p (c, a) (c, b) #
Profunctor p => Strong (Tambara p) # |
Methods first' :: Tambara p a b -> Tambara p (a, c) (b, c) # second' :: Tambara p a b -> Tambara p (c, a) (c, b) #
Strong p => Strong (Closure p) # |
Methods first' :: Closure p a b -> Closure p (a, c) (b, c) # second' :: Closure p a b -> Closure p (c, a) (c, b) #
Strong (FreeTraversing p) # |
Methods first' :: FreeTraversing p a b -> FreeTraversing p (a, c) (b, c) # second' :: FreeTraversing p a b -> FreeTraversing p (c, a) (c, b) #
Profunctor p => Strong (CofreeTraversing p) # |
Methods first' :: CofreeTraversing p a b -> CofreeTraversing p (a, c) (b, c) # second' :: CofreeTraversing p a b -> CofreeTraversing p (c, a) (c, b) #
Strong (FreeMapping p) # |
Methods first' :: FreeMapping p a b -> FreeMapping p (a, c) (b, c) # second' :: FreeMapping p a b -> FreeMapping p (c, a) (c, b) #
Profunctor p => Strong (CofreeMapping p) # |
Methods first' :: CofreeMapping p a b -> CofreeMapping p (a, c) (b, c) # second' :: CofreeMapping p a b -> CofreeMapping p (c, a) (c, b) #
(Functor f, Strong p) => Strong (Cayley f p) # |
Methods first' :: Cayley f p a b -> Cayley f p (a, c) (b, c) # second' :: Cayley f p a b -> Cayley f p (c, a) (c, b) #
(Strong p, Strong q) => Strong (Procompose p q) # |
Methods first' :: Procompose p q a b -> Procompose p q (a, c) (b, c) # second' :: Procompose p q a b -> Procompose p q (c, a) (c, b) #
Contravariant f => Strong (Clown * * f) # |
Methods first' :: Clown * * f a b -> Clown * * f (a, c) (b, c) # second' :: Clown * * f a b -> Clown * * f (c, a) (c, b) #
(Strong p, Strong q) => Strong (Product * * p q) # |
Methods first' :: Product * * p q a b -> Product * * p q (a, c) (b, c) # second' :: Product * * p q a b -> Product * * p q (c, a) (c, b) #
(Functor f, Strong p) => Strong (Tannen * * * f p) # |
Methods first' :: Tannen * * * f p a b -> Tannen * * * f p (a, c) (b, c) # second' :: Tannen * * * f p a b -> Tannen * * * f p (c, a) (c, b) #

uncurry' :: Strong p => p a (b -> c) -> p (a, b) c #

newtype Tambara p a b #

`Tambara` cofreely makes any `Profunctor` `Strong`.

Constructors

Tambara |
Fields runTambara :: forall c. p (a, c) (b, c)

Instances

ProfunctorComonad Tambara # |
Methods proextract :: Profunctor p => Tambara p :-> p # produplicate :: Profunctor p => Tambara p :-> Tambara (Tambara p) #
ProfunctorFunctor Tambara # |
Methods promap :: Profunctor p => (p :-> q) -> Tambara p :-> Tambara q #
ProfunctorAdjunction Pastro Tambara # |
Methods unit :: Profunctor p => p :-> Tambara (Pastro p) # counit :: Profunctor p => Pastro (Tambara p) :-> p #
Arrow p => Arrow (Tambara p) # |
Methods arr :: (b -> c) -> Tambara p b c # first :: Tambara p b c -> Tambara p (b, d) (c, d) # second :: Tambara p b c -> Tambara p (d, b) (d, c) # (***) :: Tambara p b c -> Tambara p b' c' -> Tambara p (b, b') (c, c') # (&&&) :: Tambara p b c -> Tambara p b c' -> Tambara p b (c, c') #
ArrowZero p => ArrowZero (Tambara p) # |
Methods zeroArrow :: Tambara p b c #
ArrowPlus p => ArrowPlus (Tambara p) # |
Methods (<+>) :: Tambara p b c -> Tambara p b c -> Tambara p b c #
ArrowChoice p => ArrowChoice (Tambara p) # |
Methods left :: Tambara p b c -> Tambara p (Either b d) (Either c d) # right :: Tambara p b c -> Tambara p (Either d b) (Either d c) # (+++) :: Tambara p b c -> Tambara p b' c' -> Tambara p (Either b b') (Either c c') # (|||) :: Tambara p b d -> Tambara p c d -> Tambara p (Either b c) d #
ArrowApply p => ArrowApply (Tambara p) # |
Methods app :: Tambara p (Tambara p b c, b) c #
ArrowLoop p => ArrowLoop (Tambara p) # |
Methods loop :: Tambara p (b, d) (c, d) -> Tambara p b c #
Profunctor p => Profunctor (Tambara p) # |
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 => (b -> c) -> Tambara p a b -> Tambara p a c # (.#) :: Coercible * b a => Tambara p b c -> (a -> b) -> Tambara p a c #
Profunctor p => Strong (Tambara p) # |
Methods first' :: Tambara p a b -> Tambara p (a, c) (b, c) # second' :: Tambara p a b -> Tambara p (c, a) (c, b) #
Choice p => Choice (Tambara p) # |
Methods left' :: Tambara p a b -> Tambara p (Either a c) (Either b c) # right' :: Tambara p a b -> Tambara p (Either c a) (Either c b) #
Category * p => Category * (Tambara p) # |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #
Profunctor p => Functor (Tambara p a) # |
Methods fmap :: (a -> b) -> Tambara p a a -> Tambara p a b # (<$) :: a -> Tambara p a b -> Tambara p a a #
(Profunctor p, Arrow p) => Applicative (Tambara p a) # |
Methods pure :: a -> Tambara p a a # (<*>) :: Tambara p a (a -> b) -> Tambara p a a -> Tambara p a b # (*>) :: Tambara p a a -> Tambara p a b -> Tambara p a b # (<*) :: Tambara p a a -> Tambara p a b -> Tambara p a a #
(Profunctor p, ArrowPlus p) => Alternative (Tambara p a) # |
Methods empty :: Tambara p a a # (<|>) :: Tambara p a a -> Tambara p a a -> Tambara p a a # some :: Tambara p a a -> Tambara p a [a] # many :: Tambara p a a -> Tambara p a [a] #
ArrowPlus p => Monoid (Tambara p a b) # |
Methods mempty :: Tambara p a b # mappend :: Tambara p a b -> Tambara p a b -> Tambara p a b # mconcat :: [Tambara p a b] -> Tambara p a b #

tambara :: Strong p => (p :-> q) -> p :-> Tambara q #

    tambara . untambara ≡ id
    untambara . tambara ≡ id

untambara :: Profunctor q => (p :-> Tambara q) -> p :-> q #

    tambara . untambara ≡ id
    untambara . tambara ≡ id

data Pastro p a b where #

Pastro -| Tambara

    Pastro p ~ exists z. Costar ((,)z) Procompose p Procompose Star ((,)z)

`Pastro` freely makes any `Profunctor` `Strong`.

Constructors

Pastro :: ((y, z) -> b) -> p x y -> (a -> (x, z)) -> Pastro p a b |

Instances

ProfunctorMonad Pastro # |
Methods proreturn :: Profunctor p => p :-> Pastro p # projoin :: Profunctor p => Pastro (Pastro p) :-> Pastro p #
ProfunctorFunctor Pastro # |
Methods promap :: Profunctor p => (p :-> q) -> Pastro p :-> Pastro q #
ProfunctorAdjunction Pastro Tambara # |
Methods unit :: Profunctor p => p :-> Tambara (Pastro p) # counit :: Profunctor p => Pastro (Tambara p) :-> p #
Profunctor (Pastro p) # |
Methods dimap :: (a -> b) -> (c -> d) -> Pastro p b c -> Pastro p a d # lmap :: (a -> b) -> Pastro p b c -> Pastro p a c # rmap :: (b -> c) -> Pastro p a b -> Pastro p a c # (#.) :: Coercible * c b => (b -> c) -> Pastro p a b -> Pastro p a c # (.#) :: Coercible * b a => Pastro p b c -> (a -> b) -> Pastro p a c #
Strong (Pastro p) # |
Methods first' :: Pastro p a b -> Pastro p (a, c) (b, c) # second' :: Pastro p a b -> Pastro p (c, a) (c, b) #

# Costrength

class Profunctor p => Costrong p where #

Analogous to `ArrowLoop`, `loop` = `unfirst`

Minimal complete definition

unfirst | unsecond

Methods

unfirst :: p (a, d) (b, d) -> p a b #

unsecond :: p (d, a) (d, b) -> p a b #

Instances

Costrong (->) # |
Methods unfirst :: ((a, d) -> (b, d)) -> a -> b # unsecond :: ((d, a) -> (d, b)) -> a -> b #
MonadFix m => Costrong (Kleisli m) # |
Methods unfirst :: Kleisli m (a, d) (b, d) -> Kleisli m a b # unsecond :: Kleisli m (d, a) (d, b) -> Kleisli m a b #
Functor f => Costrong (Cokleisli f) # |
Methods unfirst :: Cokleisli f (a, d) (b, d) -> Cokleisli f a b # unsecond :: Cokleisli f (d, a) (d, b) -> Cokleisli f a b #
Costrong (Tagged *) # |
Methods unfirst :: Tagged * (a, d) (b, d) -> Tagged * a b # unsecond :: Tagged * (d, a) (d, b) -> Tagged * a b #
ArrowLoop p => Costrong (WrappedArrow p) # |
Methods unfirst :: WrappedArrow p (a, d) (b, d) -> WrappedArrow p a b # unsecond :: WrappedArrow p (d, a) (d, b) -> WrappedArrow p a b #
Functor f => Costrong (Costar f) # |
Methods unfirst :: Costar f (a, d) (b, d) -> Costar f a b # unsecond :: Costar f (d, a) (d, b) -> Costar f a b #
Costrong (Copastro p) # |
Methods unfirst :: Copastro p (a, d) (b, d) -> Copastro p a b # unsecond :: Copastro p (d, a) (d, b) -> Copastro p a b #
Costrong (Cotambara p) # |
Methods unfirst :: Cotambara p (a, d) (b, d) -> Cotambara p a b # unsecond :: Cotambara p (d, a) (d, b) -> Cotambara p a b #
(Corepresentable p, Corepresentable q) => Costrong (Procompose p q) # |
Methods unfirst :: Procompose p q (a, d) (b, d) -> Procompose p q a b # unsecond :: Procompose p q (d, a) (d, b) -> Procompose p q a b #
(Costrong p, Costrong q) => Costrong (Product * * p q) # |
Methods unfirst :: Product * * p q (a, d) (b, d) -> Product * * p q a b # unsecond :: Product * * p q (d, a) (d, b) -> Product * * p q a b #
(Functor f, Costrong p) => Costrong (Tannen * * * f p) # |
Methods unfirst :: Tannen * * * f p (a, d) (b, d) -> Tannen * * * f p a b # unsecond :: Tannen * * * f p (d, a) (d, b) -> Tannen * * * f p a b #

data Cotambara q a b where #

Cotambara cofreely constructs costrength

Constructors

Cotambara :: Costrong r => (r :-> q) -> r a b -> Cotambara q a b |

Instances

ProfunctorComonad Cotambara # |
Methods proextract :: Profunctor p => Cotambara p :-> p # produplicate :: Profunctor p => Cotambara p :-> Cotambara (Cotambara p) #
ProfunctorFunctor Cotambara # |
Methods promap :: Profunctor p => (p :-> q) -> Cotambara p :-> Cotambara q #
ProfunctorAdjunction Copastro Cotambara # |
Methods unit :: Profunctor p => p :-> Cotambara (Copastro p) # counit :: Profunctor p => Copastro (Cotambara p) :-> p #
Profunctor (Cotambara p) # |
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 => (b -> c) -> Cotambara p a b -> Cotambara p a c # (.#) :: Coercible * b a => Cotambara p b c -> (a -> b) -> Cotambara p a c #
Costrong (Cotambara p) # |
Methods unfirst :: Cotambara p (a, d) (b, d) -> Cotambara p a b # unsecond :: Cotambara p (d, a) (d, b) -> Cotambara p a b #
Functor (Cotambara p a) # |
Methods fmap :: (a -> b) -> Cotambara p a a -> Cotambara p a b # (<$) :: a -> Cotambara p a b -> Cotambara p a a #

cotambara :: Costrong p => (p :-> q) -> p :-> Cotambara q #

    cotambara . uncotambara ≡ id
    uncotambara . cotambara ≡ id

uncotambara :: Profunctor q => (p :-> Cotambara q) -> p :-> q #

    cotambara . uncotambara ≡ id
    uncotambara . cotambara ≡ id

newtype Copastro p a b #

Copastro -| Cotambara

Copastro freely constructs costrength

Constructors

Copastro |
Fields runCopastro :: forall r. Costrong r => (forall x y. p x y -> r x y) -> r a b

Instances

ProfunctorMonad Copastro # |
Methods proreturn :: Profunctor p => p :-> Copastro p # projoin :: Profunctor p => Copastro (Copastro p) :-> Copastro p #
ProfunctorFunctor Copastro # |
Methods promap :: Profunctor p => (p :-> q) -> Copastro p :-> Copastro q #
ProfunctorAdjunction Copastro Cotambara # |
Methods unit :: Profunctor p => p :-> Cotambara (Copastro p) # counit :: Profunctor p => Copastro (Cotambara p) :-> p #
Profunctor (Copastro p) # |
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 => (b -> c) -> Copastro p a b -> Copastro p a c # (.#) :: Coercible * b a => Copastro p b c -> (a -> b) -> Copastro p a c #
Costrong (Copastro p) # |
Methods unfirst :: Copastro p (a, d) (b, d) -> Copastro p a b # unsecond :: Copastro p (d, a) (d, b) -> Copastro p a b #