Data.Profunctor.Traversing

profunctors-5.2: Profunctors

Safe Haskell | None
Language | Haskell2010

Data.Profunctor.Traversing

Contents

- Strong in terms of Traversing
- Choice in terms of Traversing

Synopsis

- class (Choice p, Strong p) => Traversing p where
- newtype CofreeTraversing p a b = CofreeTraversing {
  - runCofreeTraversing :: forall f. Traversable f => p (f a) (f b)
  }
- data FreeTraversing p a b where
  - FreeTraversing :: Traversable f => (f y -> b) -> p x y -> (a -> f x) -> FreeTraversing p a b
- firstTraversing :: Traversing p => p a b -> p (a, c) (b, c)
- secondTraversing :: Traversing p => p a b -> p (c, a) (c, b)
- leftTraversing :: Traversing p => p a b -> p (Either a c) (Either b c)
- rightTraversing :: Traversing p => p a b -> p (Either c a) (Either c b)

# Documentation

class (Choice p, Strong p) => Traversing p where #

Note: Definitions in terms of `wander` are much more efficient!

Minimal complete definition

wander | traverse'

Methods

traverse' :: Traversable f => p a b -> p (f a) (f b) #

wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> p a b -> p s t #

Instances

Traversing (->) # |
Methods traverse' :: Traversable f => (a -> b) -> f a -> f b # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> (a -> b) -> s -> t #
Monad m => Traversing (Kleisli m) # |
Methods traverse' :: Traversable f => Kleisli m a b -> Kleisli m (f a) (f b) # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> Kleisli m a b -> Kleisli m s t #
Applicative m => Traversing (Star m) # |
Methods traverse' :: Traversable f => Star m a b -> Star m (f a) (f b) # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> Star m a b -> Star m s t #
Traversing (FreeTraversing p) # |
Methods traverse' :: Traversable f => FreeTraversing p a b -> FreeTraversing p (f a) (f b) # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> FreeTraversing p a b -> FreeTraversing p s t #
Profunctor p => Traversing (CofreeTraversing p) # |
Methods traverse' :: Traversable f => CofreeTraversing p a b -> CofreeTraversing p (f a) (f b) # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> CofreeTraversing p a b -> CofreeTraversing p s t #
Traversing (FreeMapping p) # |
Methods traverse' :: Traversable f => FreeMapping p a b -> FreeMapping p (f a) (f b) # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> FreeMapping p a b -> FreeMapping p s t #
Profunctor p => Traversing (CofreeMapping p) # |
Methods traverse' :: Traversable f => CofreeMapping p a b -> CofreeMapping p (f a) (f b) # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> CofreeMapping p a b -> CofreeMapping p s t #

newtype CofreeTraversing p a b #

Constructors

CofreeTraversing |
Fields runCofreeTraversing :: forall f. Traversable f => p (f a) (f b)

Instances

ProfunctorComonad CofreeTraversing # |
Methods proextract :: Profunctor p => CofreeTraversing p :-> p # produplicate :: Profunctor p => CofreeTraversing p :-> CofreeTraversing (CofreeTraversing p) #
ProfunctorFunctor CofreeTraversing # |
Methods promap :: Profunctor p => (p :-> q) -> CofreeTraversing p :-> CofreeTraversing q #
Profunctor p => Profunctor (CofreeTraversing p) # |
Methods dimap :: (a -> b) -> (c -> d) -> CofreeTraversing p b c -> CofreeTraversing p a d # lmap :: (a -> b) -> CofreeTraversing p b c -> CofreeTraversing p a c # rmap :: (b -> c) -> CofreeTraversing p a b -> CofreeTraversing p a c # (#.) :: Coercible * c b => (b -> c) -> CofreeTraversing p a b -> CofreeTraversing p a c # (.#) :: Coercible * b a => CofreeTraversing p b c -> (a -> b) -> CofreeTraversing p a c #
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) #
Profunctor p => Choice (CofreeTraversing p) # |
Methods left' :: CofreeTraversing p a b -> CofreeTraversing p (Either a c) (Either b c) # right' :: CofreeTraversing p a b -> CofreeTraversing p (Either c a) (Either c b) #
Profunctor p => Traversing (CofreeTraversing p) # |
Methods traverse' :: Traversable f => CofreeTraversing p a b -> CofreeTraversing p (f a) (f b) # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> CofreeTraversing p a b -> CofreeTraversing p s t #

data FreeTraversing p a b where #

    FreeTraversing -| CofreeTraversing

Constructors

FreeTraversing :: Traversable f => (f y -> b) -> p x y -> (a -> f x) -> FreeTraversing p a b |

Instances

ProfunctorMonad FreeTraversing # |
Methods proreturn :: Profunctor p => p :-> FreeTraversing p # projoin :: Profunctor p => FreeTraversing (FreeTraversing p) :-> FreeTraversing p #
ProfunctorFunctor FreeTraversing # |
Methods promap :: Profunctor p => (p :-> q) -> FreeTraversing p :-> FreeTraversing q #
Profunctor (FreeTraversing p) # |
Methods dimap :: (a -> b) -> (c -> d) -> FreeTraversing p b c -> FreeTraversing p a d # lmap :: (a -> b) -> FreeTraversing p b c -> FreeTraversing p a c # rmap :: (b -> c) -> FreeTraversing p a b -> FreeTraversing p a c # (#.) :: Coercible * c b => (b -> c) -> FreeTraversing p a b -> FreeTraversing p a c # (.#) :: Coercible * b a => FreeTraversing p b c -> (a -> b) -> FreeTraversing p a c #
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) #
Choice (FreeTraversing p) # |
Methods left' :: FreeTraversing p a b -> FreeTraversing p (Either a c) (Either b c) # right' :: FreeTraversing p a b -> FreeTraversing p (Either c a) (Either c b) #
Traversing (FreeTraversing p) # |
Methods traverse' :: Traversable f => FreeTraversing p a b -> FreeTraversing p (f a) (f b) # wander :: (forall f. Applicative f => (a -> f b) -> s -> f t) -> FreeTraversing p a b -> FreeTraversing p s t #

# Strong in terms of Traversing

firstTraversing :: Traversing p => p a b -> p (a, c) (b, c) #

secondTraversing :: Traversing p => p a b -> p (c, a) (c, b) #

# Choice in terms of Traversing

leftTraversing :: Traversing p => p a b -> p (Either a c) (Either b c) #

rightTraversing :: Traversing p => p a b -> p (Either c a) (Either c b) #