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

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)

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

Instances

Choice (->) 
Monad m => Choice (Kleisli m) 
Comonad w => Choice (Cokleisli w)

extract approximates costrength

Choice (Tagged *) 
Monoid r => Choice (Forget r) 
ArrowChoice p => Choice (WrappedArrow p) 
Traversable w => Choice (Costar w) 
Applicative f => Choice (Star f) 
Choice p => Choice (Tambara p) 
Choice (PastroSum p) 
Profunctor p => Choice (TambaraSum p) 
Choice (FreeTraversing p) 
Profunctor p => Choice (CofreeTraversing p) 
Choice (FreeMapping p) 
Profunctor p => Choice (CofreeMapping p) 
(Functor f, Choice p) => Choice (Cayley f p) 
(Choice p, Choice q) => Choice (Procompose p q) 
Functor f => Choice (Joker * * f) 
(Choice p, Choice q) => Choice (Product * * p q) 
(Functor f, Choice p) => Choice (Tannen * * * f p) 

newtype TambaraSum p a b

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

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

Minimal complete definition

unleft | unright

Methods

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

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

Instances

data CotambaraSum q a b where

CotambaraSum cofreely constructs costrength with respect to Either (aka Choice)

Constructors

CotambaraSum :: Cochoice r => (r :-> q) -> r a b -> CotambaraSum q a b 

newtype CopastroSum p a b

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