profunctor-optics-0.0.2: A compact optics library compatible with the typeclasses in profunctors.

Safe HaskellNone
LanguageHaskell2010

Data.Profunctor.Optic.Traversal

Contents

Synopsis

Traversal0

type Traversal0 s t a b = forall p. Affine p => Optic p s t a b Source #

\( \mathsf{Traversal0}\;S\;A = \exists C, D, S \cong D + C \times A \)

type Traversal0' s a = Traversal0 s s a a Source #

traversal0 :: (s -> t + a) -> (s -> b -> t) -> Traversal0 s t a b Source #

Create a Traversal0 from match and constructor functions.

Caution: In order for the Traversal0 to be well-defined, you must ensure that the input functions satisfy the following properties:

  • sta (sbt a s) ≡ either (Left . const a) Right (sta s)
  • either id (sbt s) (sta s) ≡ s
  • sbt (sbt s a1) a2 ≡ sbt s a2

More generally, a profunctor optic must be monoidal as a natural transformation:

See Property.

traversal0' :: (s -> Maybe a) -> (s -> a -> s) -> Traversal0' s a Source #

Obtain a Traversal0' from match and constructor functions.

traversal0Vl :: (forall f. Functor f => (forall c. c -> f c) -> (a -> f b) -> s -> f t) -> Traversal0 s t a b Source #

Transform a Van Laarhoven Traversal0 into a profunctor Traversal0.

Traversal

type Traversal s t a b = forall p. (Affine p, Traversing p) => Optic p s t a b Source #

\( \mathsf{Traversal}\;S\;A = \exists F : \mathsf{Traversable}, S \equiv F\,A \)

type Traversal' s a = Traversal s s a a Source #

type Cotraversal s t a b = forall p. (Coaffine p, Cotraversing p) => Optic p s t a b Source #

\( \mathsf{Cotraversal}\;S\;A = \exists F : \mathsf{Distributive}, S \equiv F\,A \)

type Cotraversal' t b = Cotraversal t t b b Source #

traversing :: Traversable f => (s -> a) -> (s -> b -> t) -> Traversal (f s) (f t) a b Source #

Obtain a Traversal by lifting a lens getter and setter into a Traversable functor.

 withLens o traversingtraversed . o

Compare folding.

Caution: In order for the generated optic to be well-defined, you must ensure that the input functions constitute a legal lens:

  • sa (sbt s a) ≡ a
  • sbt s (sa s) ≡ s
  • sbt (sbt s a1) a2 ≡ sbt s a2

See Property.

The resulting optic can detect copies of the lens stucture inside any Traversable container. For example:

>>> lists (traversing snd $ \(s,_) b -> (s,b)) [(0,'f'),(1,'o'),(2,'o'),(3,'b'),(4,'a'),(5,'r')]
"foobar"

traversalVl :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> Traversal s t a b Source #

Obtain a profunctor Traversal from a Van Laarhoven Traversal.

Caution: In order for the generated optic to be well-defined, you must ensure that the input satisfies the following properties:

  • abst pure ≡ pure
  • fmap (abst f) . abst g ≡ getCompose . abst (Compose . fmap f . g)

The traversal laws can be stated in terms of withStar:

  • withStar t (pure . f) ≡ pure (fmap f)
  • Compose . fmap (withStar t f) . withStar t g ≡ withStar t (Compose . fmap f . g)

See Property.

cotraversing :: Distributive g => (((s -> a) -> b) -> t) -> Cotraversal (g s) (g t) a b Source #

Obtain a Cotraversal by embedding a continuation into a Distributive functor.

 withGrate o cotraversingcotraversed . o

Caution: In order for the generated optic to be well-defined, you must ensure that the input function satisfies the following properties:

  • sabt ($ s) ≡ s
  • sabt (k -> f (k . sabt)) ≡ sabt (k -> f ($ k))

retraversing :: Distributive g => (b -> t) -> (b -> s -> a) -> Cotraversal (g s) (g t) a b Source #

Obtain a Cotraversal by embedding a reversed lens getter and setter into a Distributive functor.

 withLens (re o) cotraversingcotraversed . o

cotraversalVl :: (forall f. Coapplicative f => (f a -> b) -> f s -> t) -> Cotraversal s t a b Source #

Obtain a profunctor Cotraversal from a Van Laarhoven Cotraversal.

Caution: In order for the generated optic to be well-defined, you must ensure that the input satisfies the following properties:

  • abst copure ≡ copure
  • abst f . fmap (abst g) ≡ abst (f . fmap g . getCompose) . Compose

The cotraversal laws can be restated in terms of withCostar:

  • withCostar o (f . copure) ≡  fmap f . copure
  • withCostar o f . fmap (withCostar o g) == withCostar o (f . fmap g . getCompose) . Compose

See Property.

Traversal1

type Traversal1 s t a b = forall p. (Strong p, Traversing1 p) => Optic p s t a b Source #

\( \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, Cotraversing1 p) => Optic p s t a b Source #

\( \mathsf{Cotraversal1}\;S\;A = \exists F : \mathsf{Distributive1}, S \equiv F\,A \)

type Cotraversal1' t b = Cotraversal1 t t b b Source #

traversing1 :: Traversable1 f => (s -> a) -> (s -> b -> t) -> Traversal1 (f s) (f t) a b Source #

Obtain a Traversal by lifting a lens getter and setter into a Traversable functor.

 withLens o traversingtraversed . o

Caution: In order for the generated optic to be well-defined, you must ensure that the input functions constitute a legal lens:

  • sa (sbt s a) ≡ a
  • sbt s (sa s) ≡ s
  • sbt (sbt s a1) a2 ≡ sbt s a2

See Property.

The resulting optic can detect copies of the lens stucture inside any Traversable container. For example:

>>> lists (traversing snd $ \(s,_) b -> (s,b)) [(0,'f'),(1,'o'),(2,'o'),(3,'b'),(4,'a'),(5,'r')]
"foobar"

Compare folding.

traversal1Vl :: (forall f. Apply f => (a -> f b) -> s -> f t) -> Traversal1 s t a b Source #

Obtain a profunctor Traversal1 from a Van Laarhoven Traversal1.

Caution: In order for the generated family to be well-defined, you must ensure that the traversal1 law holds for the input function:

  • fmap (abst f) . abst g ≡ getCompose . abst (Compose . fmap f . g)

See Property.

pappend :: Traversing1 p => p a b -> p a b -> p a b Source #

(<<*>>) :: Traversing1 p => p a (b -> c) -> p a b -> p a c infixl 4 Source #

Profunctor version of <*>.

(****) :: Traversing1 p => p a1 b1 -> p a2 b2 -> p (a1, a2) (b1, b2) infixr 3 Source #

Profunctor version of ***.

(&&&&) :: Traversing1 p => p a b1 -> p a b2 -> p a (b1, b2) infixr 3 Source #

Profunctor version of &&&.

divide :: Traversing1 p => (a -> (a1, a2)) -> p a1 b -> p a2 b -> p a b Source #

Profunctor version of divide.

divide' :: Traversing1 p => p a1 b -> p a2 b -> p (a1, a2) b Source #

cochoose :: Traversing1 p => ((b1, b2) -> b) -> p a b1 -> p a b2 -> p a b Source #

cochoose' :: Traversing1 p => p a b1 -> p a b2 -> p a (b1, b2) Source #

cotraversing1 :: Distributive1 g => (((s -> a) -> b) -> t) -> Cotraversal1 (g s) (g t) a b Source #

Obtain a Cotraversal1 by embedding a continuation into a Distributive1 functor.

 withGrate o cotraversing1cotraversed1 . o

Caution: In order for the generated optic to be well-defined, you must ensure that the input function satisfies the following properties:

  • sabt ($ s) ≡ s
  • sabt (k -> f (k . sabt)) ≡ sabt (k -> f ($ k))

retraversing1 :: Distributive1 g => (b -> t) -> (b -> s -> a) -> Cotraversal1 (g s) (g t) a b Source #

Obtain a Cotraversal1 by embedding a reversed lens getter and setter into a Distributive1 functor.

 withLens (re o) cotraversingcotraversed . o

cotraversal1Vl :: (forall f. Coapply f => (f a -> b) -> f s -> t) -> Cotraversal1 s t a b Source #

Obtain a profunctor Cotraversal1 from a Van Laarhoven Cotraversal1.

Caution: In order for the generated optic to be well-defined, you must ensure that the input satisfies the following properties:

  • abst runIdentity ≡ runIdentity
  • abst f . fmap (abst g) ≡ abst (f . fmap g . getCompose) . Compose

The cotraversal1 laws can be restated in terms of withCostar:

  • withCostar o (f . runIdentity) ≡  fmap f . runIdentity
  • withCostar o f . fmap (withCostar o g) == withCostar o (f . fmap g . getCompose) . Compose

See Property.

(++++) :: Cotraversing1 p => p a1 b1 -> p a2 b2 -> p (a1 + a2) (b1 + b2) infixr 2 Source #

Profunctor version of +++.

(||||) :: Cotraversing1 p => p a1 b -> p a2 b -> p (a1 + a2) b infixr 2 Source #

Profunctor version of |||.

codivide :: Cotraversing1 p => ((b1 + b2) -> b) -> p a b1 -> p a b2 -> p a b Source #

codivide' :: Cotraversing1 p => p a b1 -> p a b2 -> p a (b1 + b2) Source #

choose :: Cotraversing1 p => (a -> a1 + a2) -> p a1 b -> p a2 b -> p a b Source #

Profunctor version of choose.

choose' :: Cotraversing1 p => p a1 b -> p a2 b -> p (a1 + a2) b Source #

Optics

nulled :: Traversal0' s a Source #

TODO: Document

selected :: (a -> Bool) -> Traversal0' (a, b) b Source #

TODO: Document

traversed :: Traversable f => Traversal (f a) (f b) a b Source #

TODO: Document

cotraversed :: Distributive f => Cotraversal (f a) (f b) a b Source #

TODO: Document

traversed1 :: Traversable1 t => Traversal1 (t a) (t b) a b Source #

Obtain a Traversal1 from a Traversable1 functor.

cotraversed1 :: Distributive1 f => Cotraversal1 (f a) (f b) a b Source #

TODO: Document

both :: Traversal (a, a) (b, b) a b Source #

TODO: Document

>>> traverses both (pure . length) ("hello","world")
(5,5)

coboth :: Cotraversal (a + a) (b + b) a b Source #

TODO: Document

both1 :: Traversal1 (a, a) (b, b) a b Source #

TODO: Document

>>> traverses both1 (pure . NE.length) ('h' :| "ello", 'w' :| "orld")
(5,5)

coboth1 :: Cotraversal1 (a + a) (b + b) a b Source #

TODO: Document

>>> cotraverses1 coboth1 (foldMap id) $ Left "foo" :| [Right "bar"]
Left "foo"
>>> cotraverses1 coboth1 (foldMap id) $ Right "foo" :| [Right "bar"]
Right "foobar"

duplicated :: Traversal a b a b Source #

Duplicate the results of a Traversal.

>>> lists (both . duplicated) ("hello","world")
["hello","hello","world","world"]

beside :: Bitraversable r => Traversal s1 t1 a b -> Traversal s2 t2 a b -> Traversal (r s1 s2) (r t1 t2) a b Source #

TODO: Document

bitraversed :: Bitraversable f => Traversal (f a a) (f b b) a b Source #

Traverse both parts of a Bitraversable container with matching types.

>>> traverses bitraversed (pure . length) (Right "hello")
Right 5
>>> traverses bitraversed (pure . length) ("hello","world")
(5,5)
>>> ("hello","world") ^. bitraversed
"helloworld"
bitraversed :: Traversal (a , a) (b , b) a b
bitraversed :: Traversal (a + a) (b + b) a b

bitraversed1 :: Bitraversable1 r => Traversal1 (r a a) (r b b) a b Source #

Traverse both parts of a Bitraversable1 container with matching types.

>>> traverses bitraversed1 (pure . NE.length) ('h' :| "ello", 'w' :| "orld")
(5,5)

repeated :: Traversal1' a a Source #

Obtain a Traversal1' by repeating the input forever.

repeatlists repeated
>>> take 5 $ 5 ^.. repeated
[5,5,5,5,5]
repeated :: Fold1 a a

iterated :: (a -> a) -> Traversal1' a a Source #

x ^. iterated f returns an infinite Traversal1' of repeated applications of f to x.

lists (iterated f) a ≡ iterate f a
>>> take 3 $ (1 :: Int) ^.. iterated (+1)
[1,2,3]
iterated :: (a -> a) -> Fold1 a a

cycled :: Apply f => ATraversal1' f s a -> ATraversal1' f s a Source #

Transform a Traversal1' into a Traversal1' that loops over its elements repeatedly.

>>> take 7 $ (1 :| [2,3]) ^.. cycled traversed1
[1,2,3,1,2,3,1]
cycled :: Fold1 s a -> Fold1 s a

Operators

matches :: ATraversal0 s t a b -> s -> t + a Source #

Test whether the optic matches or not.

>>> matches just (Just 2)
Right 2
>>> matches just (Nothing :: Maybe Int) :: Either (Maybe Bool) Int
Left Nothing

traverses :: Applicative f => ATraversal f s t a b -> (a -> f b) -> s -> f t Source #

TODO: Document

cotraverses :: Coapplicative f => ACotraversal f s t a b -> (f a -> b) -> f s -> t Source #

TODO: Document

cotraverses1 :: Coapply f => ACotraversal1 f s t a b -> (f a -> b) -> f s -> t Source #

TODO: Document

traverses1 :: Apply f => ATraversal1 f s t a b -> (a -> f b) -> s -> f t Source #

TODO: Document

sequences :: Applicative f => ATraversal f s t (f a) a -> s -> f t Source #

TODO: Document

collects :: Coapplicative f => ACotraversal f s t a (f a) -> f s -> t Source #

TODO: Document

>>> collects left' (1, Left "foo") :: Either (Int8, String) String
Left (1,"foo")
>>> collects left' (1, Right "foo")
Right "foo"

sequences1 :: Apply f => ATraversal1 f s t (f a) a -> s -> f t Source #

TODO: Document

collects1 :: Coapply f => ACotraversal1 f s t a (f a) -> f s -> t Source #

TODO: Document

>>> collects1 cotraversed1 ["xxx","ooo"] :: [String]
["xo","xo","xo"]

Classes

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

Minimal complete definition

first' | second'

Methods

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

Laws:

first'dimap swap swap . second'
lmap fstrmap fst . first'
lmap (second' f) . first'rmap (second' f) . first'
first' . first'dimap assoc unassoc . first' where
  assoc ((a,b),c) = (a,(b,c))
  unassoc (a,(b,c)) = ((a,b),c)

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

Laws:

second'dimap swap swap . first'
lmap sndrmap snd . second'
lmap (first' f) . second'rmap (first' f) . second'
second' . second'dimap unassoc assoc . second' where
  assoc ((a,b),c) = (a,(b,c))
  unassoc (a,(b,c)) = ((a,b),c)
Instances
Monad m => Strong (Kleisli m) 
Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

Strong p => Strong (Yoneda p) 
Instance details

Defined in Data.Profunctor.Yoneda

Methods

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

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

Strong p => Strong (Coyoneda p) 
Instance details

Defined in Data.Profunctor.Yoneda

Methods

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

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

Strong p => Strong (Closure p) 
Instance details

Defined in Data.Profunctor.Closed

Methods

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

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

Profunctor p => Strong (Tambara p) 
Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

Strong (Pastro p) 
Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

Functor m => Strong (Star m) 
Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

Arrow p => Strong (WrappedArrow p)

Arrow is Strong Category

Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

Strong (Forget r) 
Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

Strong (Lin a) 
Instance details

Defined in Data.Semimodule.Free

Methods

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

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

Strong (Conjoin j) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

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

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

Strong (Fold0Rep r) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

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

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

Strong ((->) :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

Strong (Traversal0Rep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

first' :: Traversal0Rep a b a0 b0 -> Traversal0Rep a b (a0, c) (b0, c) #

second' :: Traversal0Rep a b a0 b0 -> Traversal0Rep a b (c, a0) (c, b0) #

Strong (LensRep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

first' :: LensRep a b a0 b0 -> LensRep a b (a0, c) (b0, c) #

second' :: LensRep a b a0 b0 -> LensRep a b (c, a0) (c, b0) #

Contravariant f => Strong (Clown f :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

Costrong p => Strong (Re p s t) Source # 
Instance details

Defined in Data.Profunctor.Optic.Types

Methods

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

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

(Strong p, Strong q) => Strong (Sum p q) 
Instance details

Defined in Data.Profunctor.Strong

Methods

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

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

(Strong p, Strong q) => Strong (Product p q) 
Instance details

Defined in Data.Profunctor.Strong

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) 
Instance details

Defined in Data.Profunctor.Strong

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) #

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.

Minimal complete definition

left' | right'

Methods

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

Laws:

left'dimap swapE swapE . right' where
  swapE :: Either a b -> Either b a
  swapE = either Right Left
rmap Leftlmap Left . left'
lmap (right f) . left'rmap (right f) . left'
left' . left'dimap assocE unassocE . left' where
  assocE :: Either (Either a b) c -> Either a (Either b c)
  assocE (Left (Left a)) = Left a
  assocE (Left (Right b)) = Right (Left b)
  assocE (Right c) = Right (Right c)
  unassocE :: Either a (Either b c) -> Either (Either a b) c
  unassocE (Left a) = Left (Left a)
  unassocE (Right (Left b)) = Left (Right b)
  unassocE (Right (Right c)) = Right c

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

Laws:

right'dimap swapE swapE . left' where
  swapE :: Either a b -> Either b a
  swapE = either Right Left
rmap Rightlmap Right . right'
lmap (left f) . right'rmap (left f) . right'
right' . right'dimap unassocE assocE . right' where
  assocE :: Either (Either a b) c -> Either a (Either b c)
  assocE (Left (Left a)) = Left a
  assocE (Left (Right b)) = Right (Left b)
  assocE (Right c) = Right (Right c)
  unassocE :: Either a (Either b c) -> Either (Either a b) c
  unassocE (Left a) = Left (Left a)
  unassocE (Right (Left b)) = Left (Right b)
  unassocE (Right (Right c)) = Right c
Instances
Monad m => Choice (Kleisli m) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Kleisli m a b -> Kleisli m (Either a c) (Either b c) #

right' :: Kleisli m a b -> Kleisli m (Either c a) (Either c b) #

Choice p => Choice (Yoneda p) 
Instance details

Defined in Data.Profunctor.Yoneda

Methods

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

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

Choice p => Choice (Coyoneda p) 
Instance details

Defined in Data.Profunctor.Yoneda

Methods

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

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

Profunctor p => Choice (TambaraSum p) 
Instance details

Defined in Data.Profunctor.Choice

Methods

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

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

Choice (PastroSum p) 
Instance details

Defined in Data.Profunctor.Choice

Methods

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

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

Choice p => Choice (Tambara p) 
Instance details

Defined in Data.Profunctor.Choice

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) #

Applicative f => Choice (Star f) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Star f a b -> Star f (Either a c) (Either b c) #

right' :: Star f a b -> Star f (Either c a) (Either c b) #

Coapplicative f => Choice (Costar f) Source # 
Instance details

Defined in Data.Profunctor.Optic.Types

Methods

left' :: Costar f a b -> Costar f (Either a c) (Either b c) #

right' :: Costar f a b -> Costar f (Either c a) (Either c b) #

ArrowChoice p => Choice (WrappedArrow p) 
Instance details

Defined in Data.Profunctor.Choice

Methods

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

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

Monoid r => Choice (Forget r) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Forget r a b -> Forget r (Either a c) (Either b c) #

right' :: Forget r a b -> Forget r (Either c a) (Either c b) #

Choice (Lin a) 
Instance details

Defined in Data.Semimodule.Free

Methods

left' :: Lin a a0 b -> Lin a (Either a0 c) (Either b c) #

right' :: Lin a a0 b -> Lin a (Either c a0) (Either c b) #

Choice (Tagged :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Tagged a b -> Tagged (Either a c) (Either b c) #

right' :: Tagged a b -> Tagged (Either c a) (Either c b) #

Choice (Conjoin j) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

left' :: Conjoin j a b -> Conjoin j (Either a c) (Either b c) #

right' :: Conjoin j a b -> Conjoin j (Either c a) (Either c b) #

Choice (Fold0Rep r) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

left' :: Fold0Rep r a b -> Fold0Rep r (Either a c) (Either b c) #

right' :: Fold0Rep r a b -> Fold0Rep r (Either c a) (Either c b) #

Choice ((->) :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: (a -> b) -> Either a c -> Either b c #

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

Comonad w => Choice (Cokleisli w)

extract approximates costrength

Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Cokleisli w a b -> Cokleisli w (Either a c) (Either b c) #

right' :: Cokleisli w a b -> Cokleisli w (Either c a) (Either c b) #

Choice (Cotraversal0Rep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

left' :: Cotraversal0Rep a b a0 b0 -> Cotraversal0Rep a b (Either a0 c) (Either b0 c) #

right' :: Cotraversal0Rep a b a0 b0 -> Cotraversal0Rep a b (Either c a0) (Either c b0) #

Choice (Traversal0Rep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

left' :: Traversal0Rep a b a0 b0 -> Traversal0Rep a b (Either a0 c) (Either b0 c) #

right' :: Traversal0Rep a b a0 b0 -> Traversal0Rep a b (Either c a0) (Either c b0) #

Choice (PrismRep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

left' :: PrismRep a b a0 b0 -> PrismRep a b (Either a0 c) (Either b0 c) #

right' :: PrismRep a b a0 b0 -> PrismRep a b (Either c a0) (Either c b0) #

Functor f => Choice (Joker f :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Joker f a b -> Joker f (Either a c) (Either b c) #

right' :: Joker f a b -> Joker f (Either c a) (Either c b) #

Cochoice p => Choice (Re p s t) Source # 
Instance details

Defined in Data.Profunctor.Optic.Types

Methods

left' :: Re p s t a b -> Re p s t (Either a c) (Either b c) #

right' :: Re p s t a b -> Re p s t (Either c a) (Either c b) #

(Choice p, Choice q) => Choice (Sum p q) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Sum p q a b -> Sum p q (Either a c) (Either b c) #

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

(Choice p, Choice q) => Choice (Product p q) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Product p q a b -> Product p q (Either a c) (Either b c) #

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

(Functor f, Choice p) => Choice (Tannen f p) 
Instance details

Defined in Data.Profunctor.Choice

Methods

left' :: Tannen f p a b -> Tannen f p (Either a c) (Either b c) #

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

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

closed :: p a b -> p (x -> a) (x -> b) #

Instances
(Distributive f, Monad f) => Closed (Kleisli f) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Kleisli f a b -> Kleisli f (x -> a) (x -> b) #

Closed p => Closed (Yoneda p) 
Instance details

Defined in Data.Profunctor.Yoneda

Methods

closed :: Yoneda p a b -> Yoneda p (x -> a) (x -> b) #

Closed p => Closed (Coyoneda p) 
Instance details

Defined in Data.Profunctor.Yoneda

Methods

closed :: Coyoneda p a b -> Coyoneda p (x -> a) (x -> b) #

Profunctor p => Closed (Closure p) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Closure p a b -> Closure p (x -> a) (x -> b) #

Closed (Environment p) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Environment p a b -> Environment p (x -> a) (x -> b) #

Distributive f => Closed (Star f) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Star f a b -> Star f (x -> a) (x -> b) #

Functor f => Closed (Costar f) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Costar f a b -> Costar f (x -> a) (x -> b) #

Closed (Tagged :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Tagged a b -> Tagged (x -> a) (x -> b) #

Closed (Conjoin j) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

closed :: Conjoin j a b -> Conjoin j (x -> a) (x -> b) #

Closed ((->) :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: (a -> b) -> (x -> a) -> (x -> b) #

Functor f => Closed (Cokleisli f) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Cokleisli f a b -> Cokleisli f (x -> a) (x -> b) #

Closed (Cotraversal0Rep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

closed :: Cotraversal0Rep a b a0 b0 -> Cotraversal0Rep a b (x -> a0) (x -> b0) #

Closed (GrateRep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Methods

closed :: GrateRep a b a0 b0 -> GrateRep a b (x -> a0) (x -> b0) #

(Closed p, Closed q) => Closed (Sum p q) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Sum p q a b -> Sum p q (x -> a) (x -> b) #

(Closed p, Closed q) => Closed (Product p q) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Product p q a b -> Product p q (x -> a) (x -> b) #

(Functor f, Closed p) => Closed (Tannen f p) 
Instance details

Defined in Data.Profunctor.Closed

Methods

closed :: Tannen f p a b -> Tannen f p (x -> a) (x -> b) #

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.

Associated Types

type Rep (p :: Type -> Type -> Type) :: Type -> Type #

Methods

tabulate :: (d -> Rep p c) -> p d c #

Instances
(Monad m, Functor m) => Representable (Kleisli m) 
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Rep (Kleisli m) :: Type -> Type #

Methods

tabulate :: (d -> Rep (Kleisli m) c) -> Kleisli m d c #

Functor f => Representable (Star f) 
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Rep (Star f) :: Type -> Type #

Methods

tabulate :: (d -> Rep (Star f) c) -> Star f d c #

Representable (Forget r) 
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Rep (Forget r) :: Type -> Type #

Methods

tabulate :: (d -> Rep (Forget r) c) -> Forget r d c #

Representable (Lin a) 
Instance details

Defined in Data.Semimodule.Free

Associated Types

type Rep (Lin a) :: Type -> Type #

Methods

tabulate :: (d -> Rep (Lin a) c) -> Lin a d c #

Representable (Conjoin j) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Associated Types

type Rep (Conjoin j) :: Type -> Type #

Methods

tabulate :: (d -> Rep (Conjoin j) c) -> Conjoin j d c #

Representable (Fold0Rep r) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Associated Types

type Rep (Fold0Rep r) :: Type -> Type #

Methods

tabulate :: (d -> Rep (Fold0Rep r) c) -> Fold0Rep r d c #

Representable ((->) :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Rep (->) :: Type -> Type #

Methods

tabulate :: (d -> Rep (->) c) -> d -> c #

Representable (Traversal0Rep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Associated Types

type Rep (Traversal0Rep a b) :: Type -> Type #

Methods

tabulate :: (d -> Rep (Traversal0Rep a b) c) -> Traversal0Rep a b d c #

Representable (LensRep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Associated Types

type Rep (LensRep a b) :: Type -> Type #

Methods

tabulate :: (d -> Rep (LensRep a b) c) -> LensRep 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.

Associated Types

type Corep (p :: Type -> Type -> Type) :: Type -> Type #

Methods

cotabulate :: (Corep p d -> c) -> p d c #

Instances
Functor f => Corepresentable (Costar f) 
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Corep (Costar f) :: Type -> Type #

Methods

cotabulate :: (Corep (Costar f) d -> c) -> Costar f d c #

Corepresentable (Tagged :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Corep Tagged :: Type -> Type #

Methods

cotabulate :: (Corep Tagged d -> c) -> Tagged d c #

Corepresentable (Conjoin j) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Associated Types

type Corep (Conjoin j) :: Type -> Type #

Methods

cotabulate :: (Corep (Conjoin j) d -> c) -> Conjoin j d c #

Corepresentable ((->) :: Type -> Type -> Type) 
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Corep (->) :: Type -> Type #

Methods

cotabulate :: (Corep (->) d -> c) -> d -> c #

Functor w => Corepresentable (Cokleisli w) 
Instance details

Defined in Data.Profunctor.Rep

Associated Types

type Corep (Cokleisli w) :: Type -> Type #

Methods

cotabulate :: (Corep (Cokleisli w) d -> c) -> Cokleisli w d c #

Corepresentable (GrateRep a b) Source # 
Instance details

Defined in Data.Profunctor.Optic.Carrier

Associated Types

type Corep (GrateRep a b) :: Type -> Type #

Methods

cotabulate :: (Corep (GrateRep a b) d -> c) -> GrateRep a b d c #