profunctors-5.2: Profunctors

Copyright(C) 2014-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
PortabilityRank2Types
Safe HaskellNone
LanguageHaskell2010

Data.Profunctor.Choice

Contents

Description

 

Synopsis

Strength

class Profunctor p => Choice p where Source

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.

Minimal complete definition

left' | right'

Methods

left' :: p a b -> p (Either a c) (Either b c) Source

right' :: p a b -> p (Either c a) (Either c b) Source

newtype TambaraSum p a b Source

TambaraSum is cofreely adjoins strength with respect to Either.

Note: this is not dual to Tambara. It is Tambara with respect to a different tensor.

Constructors

TambaraSum 

Fields

runTambaraSum :: forall c. p (Either a c) (Either b c)
 

data PastroSum p a b where Source

PastroSum -| TambaraSum

PastroSum freely constructs strength with respect to Either.

Constructors

PastroSum :: (Either y z -> b) -> p x y -> (a -> Either x z) -> PastroSum p a b 

Costrength

class Profunctor p => Cochoice p where Source

Minimal complete definition

unleft | unright

Methods

unleft :: p (Either a d) (Either b d) -> p a b Source

unright :: p (Either d a) (Either d b) -> p a b Source

newtype CopastroSum p a b Source

CopastroSum -| CotambaraSum

CopastroSum freely constructs costrength with respect to Either (aka Choice)

Constructors

CopastroSum 

Fields

runCopastroSum :: forall r. Cochoice r => (forall x y. p x y -> r x y) -> r a b