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

Safe Haskell None Haskell2010

Data.Profunctor.Optic.Traversal

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:

• o id ≡ id
• o (Procompose p q) ≡ Procompose (o p) (o q)

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 traversing ≡ traversed . 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 cotraversing ≡ cotraversed . 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) cotraversing ≡ cotraversed . 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 traversing ≡ traversed . 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 cotraversing1 ≡ cotraversed1 . 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) cotraversing ≡ cotraversed . 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

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)


Obtain a Traversal1' by repeating the input forever.

repeat ≡ lists 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 Methods first' :: p a b -> p (a, c) (b, c) # Laws: first' ≡ dimap swap swap . second' lmap fst ≡ rmap 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 snd ≡ rmap 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Yoneda Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Yoneda Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Closed Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Semimodule.Free Methodsfirst' :: Lin a a0 b -> Lin a (a0, c) (b, c) #second' :: Lin a a0 b -> Lin a (c, a0) (c, b) # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsfirst' :: Conjoin j a b -> Conjoin j (a, c) (b, c) #second' :: Conjoin j a b -> Conjoin j (c, a) (c, b) # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: (a -> b) -> (a, c) -> (b, c) #second' :: (a -> b) -> (c, a) -> (c, b) # Strong (Traversal0Rep a b) Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Optic.Carrier Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Optic.Types Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 detailsDefined in Data.Profunctor.Strong Methodsfirst' :: 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 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 Left ≡ lmap 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 Right ≡ lmap 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Profunctor.Yoneda Methodsleft' :: 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 detailsDefined in Data.Profunctor.Yoneda Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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) # Instance detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Profunctor.Optic.Types Methodsleft' :: 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) # Instance detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Semimodule.Free Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: Tagged a b -> Tagged (Either a c) (Either b c) #right' :: Tagged a b -> Tagged (Either c a) (Either c b) # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsleft' :: 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) # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: (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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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) # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsleft' :: 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 detailsDefined in Data.Profunctor.Optic.Carrier Methodsleft' :: 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 detailsDefined in Data.Profunctor.Optic.Carrier Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Profunctor.Optic.Types Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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 detailsDefined in Data.Profunctor.Choice Methodsleft' :: 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) # Laws: lmap (. f) . closed ≡ rmap (. f) . closed closed . closed ≡ dimap uncurry curry . closed dimap const ($()) . closed ≡ id

Instances
 (Distributive f, Monad f) => Closed (Kleisli f) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Kleisli f a b -> Kleisli f (x -> a) (x -> b) # Closed p => Closed (Yoneda p) Instance detailsDefined in Data.Profunctor.Yoneda Methodsclosed :: Yoneda p a b -> Yoneda p (x -> a) (x -> b) # Closed p => Closed (Coyoneda p) Instance detailsDefined in Data.Profunctor.Yoneda Methodsclosed :: Coyoneda p a b -> Coyoneda p (x -> a) (x -> b) # Profunctor p => Closed (Closure p) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Closure p a b -> Closure p (x -> a) (x -> b) # Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Environment p a b -> Environment p (x -> a) (x -> b) # Distributive f => Closed (Star f) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Star f a b -> Star f (x -> a) (x -> b) # Functor f => Closed (Costar f) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Costar f a b -> Costar f (x -> a) (x -> b) # Closed (Tagged :: Type -> Type -> Type) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Tagged a b -> Tagged (x -> a) (x -> b) # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsclosed :: Conjoin j a b -> Conjoin j (x -> a) (x -> b) # Closed ((->) :: Type -> Type -> Type) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: (a -> b) -> (x -> a) -> (x -> b) # Functor f => Closed (Cokleisli f) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Cokleisli f a b -> Cokleisli f (x -> a) (x -> b) # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsclosed :: Cotraversal0Rep a b a0 b0 -> Cotraversal0Rep a b (x -> a0) (x -> b0) # Closed (GrateRep a b) Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Methodsclosed :: GrateRep a b a0 b0 -> GrateRep a b (x -> a0) (x -> b0) # (Closed p, Closed q) => Closed (Sum p q) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Sum p q a b -> Sum p q (x -> a) (x -> b) # (Closed p, Closed q) => Closed (Product p q) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: Product p q a b -> Product p q (x -> a) (x -> b) # (Functor f, Closed p) => Closed (Tannen f p) Instance detailsDefined in Data.Profunctor.Closed Methodsclosed :: 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 #

Laws:

tabulate . sieve ≡ id
sieve . tabulate ≡ id

Instances
 (Monad m, Functor m) => Representable (Kleisli m) Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Rep (Kleisli m) :: Type -> Type # Methodstabulate :: (d -> Rep (Kleisli m) c) -> Kleisli m d c # Functor f => Representable (Star f) Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Rep (Star f) :: Type -> Type # Methodstabulate :: (d -> Rep (Star f) c) -> Star f d c # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Rep (Forget r) :: Type -> Type # Methodstabulate :: (d -> Rep (Forget r) c) -> Forget r d c # Instance detailsDefined in Data.Semimodule.Free Associated Typestype Rep (Lin a) :: Type -> Type # Methodstabulate :: (d -> Rep (Lin a) c) -> Lin a d c # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Associated Typestype Rep (Conjoin j) :: Type -> Type # Methodstabulate :: (d -> Rep (Conjoin j) c) -> Conjoin j d c # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Associated Typestype Rep (Fold0Rep r) :: Type -> Type # Methodstabulate :: (d -> Rep (Fold0Rep r) c) -> Fold0Rep r d c # Representable ((->) :: Type -> Type -> Type) Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Rep (->) :: Type -> Type # Methodstabulate :: (d -> Rep (->) c) -> d -> c # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Associated Typestype Rep (Traversal0Rep a b) :: Type -> Type # Methodstabulate :: (d -> Rep (Traversal0Rep a b) c) -> Traversal0Rep a b d c # Representable (LensRep a b) Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Associated Typestype Rep (LensRep a b) :: Type -> Type # Methodstabulate :: (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 #

Laws:

cotabulate . cosieve ≡ id
cosieve . cotabulate ≡ id

Instances
 Functor f => Corepresentable (Costar f) Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Corep (Costar f) :: Type -> Type # Methodscotabulate :: (Corep (Costar f) d -> c) -> Costar f d c # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Corep Tagged :: Type -> Type # Methodscotabulate :: (Corep Tagged d -> c) -> Tagged d c # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Associated Typestype Corep (Conjoin j) :: Type -> Type # Methodscotabulate :: (Corep (Conjoin j) d -> c) -> Conjoin j d c # Corepresentable ((->) :: Type -> Type -> Type) Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Corep (->) :: Type -> Type # Methodscotabulate :: (Corep (->) d -> c) -> d -> c # Instance detailsDefined in Data.Profunctor.Rep Associated Typestype Corep (Cokleisli w) :: Type -> Type # Methodscotabulate :: (Corep (Cokleisli w) d -> c) -> Cokleisli w d c # Source # Instance detailsDefined in Data.Profunctor.Optic.Carrier Associated Typestype Corep (GrateRep a b) :: Type -> Type # Methodscotabulate :: (Corep (GrateRep a b) d -> c) -> GrateRep a b d c #