Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- class (Choice p, Strong p) => Traversing (p :: Type -> Type -> Type) where
- traverse' :: Traversable f => p a b -> p (f a) (f b)
- wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> p a b -> p s t
- newtype CofreeTraversing (p :: Type -> Type -> Type) a b = CofreeTraversing {
- runCofreeTraversing :: forall (f :: Type -> Type). Traversable f => p (f a) (f b)
- data FreeTraversing (p :: Type -> Type -> Type) a b where
- FreeTraversing :: forall (f :: Type -> Type) y b (p :: Type -> Type -> Type) x a. Traversable f => (f y -> b) -> p x y -> (a -> f x) -> FreeTraversing p a b
- dimapWandering :: Traversing p => (a' -> a) -> (b -> b') -> p a b -> p a' b'
- lmapWandering :: Traversing p => (a -> b) -> p b c -> p a c
- rmapWandering :: Traversing p => (b -> c) -> p a b -> p a c
- 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 :: Type -> Type -> Type) where Source #
Note: Definitions in terms of wander
are much more efficient!
traverse' :: Traversable f => p a b -> p (f a) (f b) Source #
Laws:
traverse'
≡wander
traverse
traverse'
.
rmap
f ≡rmap
(fmap
f).
traverse'
traverse'
.
traverse'
≡dimap
Compose
getCompose
.
traverse'
dimap
Identity
runIdentity
.
traverse'
≡id
wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> p a b -> p s t Source #
This combinator is mutually defined in terms of traverse'
Instances
newtype CofreeTraversing (p :: Type -> Type -> Type) a b Source #
CofreeTraversing | |
|
Instances
data FreeTraversing (p :: Type -> Type -> Type) a b where Source #
FreeTraversing -| CofreeTraversing
FreeTraversing :: forall (f :: Type -> Type) y b (p :: Type -> Type -> Type) x a. Traversable f => (f y -> b) -> p x y -> (a -> f x) -> FreeTraversing p a b |
Instances
Profunctor in terms of Traversing
dimapWandering :: Traversing p => (a' -> a) -> (b -> b') -> p a b -> p a' b' Source #
A definition of dimap
for Traversing
instances that define
an explicit wander
.
lmapWandering :: Traversing p => (a -> b) -> p b c -> p a c Source #
lmapWandering
may be a more efficient implementation
of lmap
than the default produced from dimapWandering
.
rmapWandering :: Traversing p => (b -> c) -> p a b -> p a c Source #
rmapWandering
is the same as the default produced from
dimapWandering
.
Strong in terms of Traversing
firstTraversing :: Traversing p => p a b -> p (a, c) (b, c) Source #
secondTraversing :: Traversing p => p a b -> p (c, a) (c, b) Source #
Choice in terms of Traversing
leftTraversing :: Traversing p => p a b -> p (Either a c) (Either b c) Source #
rightTraversing :: Traversing p => p a b -> p (Either c a) (Either c b) Source #