Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class FunctorB b => TraversableB b where
- btraverse_ :: (TraversableB b, Applicative t) => (forall a. f a -> t c) -> b f -> t ()
- bsequence :: (Applicative f, TraversableB b) => b (Compose f g) -> f (b g)
- type CanDeriveGenericInstance b = (Generic (b (Target F)), Generic (b (Target G)), GTraversableB (Rep (b (Target F))), Rep (b (Target G)) ~ Repl (Target F) (Target G) (Rep (b (Target F))))
- class GTraversableB b
- gbtraverseDefault :: (Applicative t, CanDeriveGenericInstance b) => (forall a. f a -> t (g a)) -> b f -> t (b g)
Documentation
class FunctorB b => TraversableB b where Source #
Barbie-types that can be traversed from left to right. Instances should satisfy the following laws:
t .btraverse
f =btraverse
(t . f) -- naturalitybtraverse
Identity
=Identity
-- identitybtraverse
(Compose
.fmap
g . f) =Compose
.fmap
(btraverse
g) .btraverse
f -- composition
There is a default btraverse
implementation for Generic
types, so
instances can derived automatically.
btraverse :: Applicative t => (forall a. f a -> t (g a)) -> b f -> t (b g) Source #
btraverse :: (Applicative t, CanDeriveGenericInstance b) => (forall a. f a -> t (g a)) -> b f -> t (b g) Source #
Instances
TraversableB Unit Source # | |
Defined in Data.Barbie.Trivial | |
TraversableB Void Source # | |
Defined in Data.Barbie.Trivial | |
TraversableB b => TraversableB (Barbie b) Source # | |
Defined in Data.Barbie.Internal.Instances |
btraverse_ :: (TraversableB b, Applicative t) => (forall a. f a -> t c) -> b f -> t () Source #
Map each element to an action, evaluate these actions from left to right, and ignore the results.
bsequence :: (Applicative f, TraversableB b) => b (Compose f g) -> f (b g) Source #
Evaluate each action in the structure from left to right, and collect the results.
type CanDeriveGenericInstance b = (Generic (b (Target F)), Generic (b (Target G)), GTraversableB (Rep (b (Target F))), Rep (b (Target G)) ~ Repl (Target F) (Target G) (Rep (b (Target F)))) Source #
Intuivively, the requirements to have
derived are:TraversableB
B
- There is an instance of
for everyGeneric
(B f)f
- If
f
is used as argument to some type in the definition ofB
, it is only on a Barbie-type with aTraversableB
instance. - Recursive usages of
B f
are allowed to appear as argument to aTraversable
(e.g. @Maybe
(B f)')
class GTraversableB b Source #
gbtraverse
Instances
GTraversableB (V1 :: * -> *) Source # | |
Defined in Data.Barbie.Internal.Traversable gbtraverse :: Applicative t => (forall a. f a -> t (g a)) -> V1 x -> t (Repl (Target F) (Target G) V1 x) | |
GTraversableB (U1 :: * -> *) Source # | |
Defined in Data.Barbie.Internal.Traversable gbtraverse :: Applicative t => (forall a. f a -> t (g a)) -> U1 x -> t (Repl (Target F) (Target G) U1 x) | |
(K1 i c :: * -> *) ~ Repl (Target F) (Target G) (K1 i c :: * -> *) => GTraversableB (K1 i c :: * -> *) Source # | |
Defined in Data.Barbie.Internal.Traversable gbtraverse :: Applicative t => (forall a. f a -> t (g a)) -> K1 i c x -> t (Repl (Target F) (Target G) (K1 i c) x) | |
(GTraversableB l, GTraversableB r) => GTraversableB (l :+: r) Source # | |
Defined in Data.Barbie.Internal.Traversable gbtraverse :: Applicative t => (forall a. f a -> t (g a)) -> (l :+: r) x -> t (Repl (Target F) (Target G) (l :+: r) x) | |
(GTraversableB l, GTraversableB r) => GTraversableB (l :*: r) Source # | |
Defined in Data.Barbie.Internal.Traversable gbtraverse :: Applicative t => (forall a. f a -> t (g a)) -> (l :*: r) x -> t (Repl (Target F) (Target G) (l :*: r) x) | |
GTraversableB x => GTraversableB (M1 i c x) Source # | |
Defined in Data.Barbie.Internal.Traversable gbtraverse :: Applicative t => (forall a. f a -> t (g a)) -> M1 i c x x0 -> t (Repl (Target F) (Target G) (M1 i c x) x0) |
gbtraverseDefault :: (Applicative t, CanDeriveGenericInstance b) => (forall a. f a -> t (g a)) -> b f -> t (b g) Source #