Data.Bitraversable
- Package
- purescript-foldable-traversable
- Repository
- purescript/purescript-foldable-traversable
#Bitraversable Source
class (Bifunctor t, Bifoldable t) <= Bitraversable t where
Bitraversable
represents data structures with two type arguments which can be
traversed.
A traversal for such a structure requires two functions, one for each type argument. Type class instances should choose the appropriate function based on the type of the element encountered at each point of the traversal.
Default implementations are provided by the following functions:
bitraverseDefault
bisequenceDefault
Members
bitraverse :: forall d c b a f. Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bisequence :: forall b a f. Applicative f => t (f a) (f b) -> f (t a b)
Instances
(Traversable f) => Bitraversable (Clown f)
(Traversable f) => Bitraversable (Joker f)
(Bitraversable p) => Bitraversable (Flip p)
(Bitraversable f, Bitraversable g) => Bitraversable (Product f g)
(Bitraversable p) => Bitraversable (Wrap p)
#bitraverseDefault Source
bitraverseDefault :: forall d c b a f t. Bitraversable t => Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
A default implementation of bitraverse
using bisequence
and bimap
.
#bisequenceDefault Source
bisequenceDefault :: forall b a f t. Bitraversable t => Applicative f => t (f a) (f b) -> f (t a b)
A default implementation of bisequence
using bitraverse
.
#ltraverse Source
ltraverse :: forall f a c b t. Bitraversable t => Applicative f => (a -> f c) -> t a b -> f (t c b)
#rtraverse Source
rtraverse :: forall f a c b t. Bitraversable t => Applicative f => (b -> f c) -> t a b -> f (t a c)
#bifor Source
bifor :: forall d c b a f t. Bitraversable t => Applicative f => t a b -> (a -> f c) -> (b -> f d) -> f (t c d)
Traverse a data structure, accumulating effects and results using an Applicative
functor.
#lfor Source
lfor :: forall f a c b t. Bitraversable t => Applicative f => t a b -> (a -> f c) -> f (t c b)
#rfor Source
rfor :: forall f a c b t. Bitraversable t => Applicative f => t a b -> (b -> f c) -> f (t a c)
Re-exports from Data.Bifoldable
#Bifoldable Source
class Bifoldable p where
Bifoldable
represents data structures with two type arguments which can be
folded.
A fold for such a structure requires two step functions, one for each type argument. Type class instances should choose the appropriate step function based on the type of the element encountered at each point of the fold.
Default implementations are provided by the following functions:
bifoldrDefault
bifoldlDefault
bifoldMapDefaultR
bifoldMapDefaultL
Note: some combinations of the default implementations are unsafe to use together - causing a non-terminating mutually recursive cycle. These combinations are documented per function.
Members
bifoldr :: forall c b a. (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c
bifoldl :: forall c b a. (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c
bifoldMap :: forall b a m. Monoid m => (a -> m) -> (b -> m) -> p a b -> m
Instances
(Foldable f) => Bifoldable (Clown f)
(Foldable f) => Bifoldable (Joker f)
(Bifoldable p) => Bifoldable (Flip p)
(Bifoldable f, Bifoldable g) => Bifoldable (Product f g)
(Bifoldable p) => Bifoldable (Wrap p)
#bitraverse_ Source
bitraverse_ :: forall d c b a f t. Bifoldable t => Applicative f => (a -> f c) -> (b -> f d) -> t a b -> f Unit
Traverse a data structure, accumulating effects using an Applicative
functor,
ignoring the final result.
#bisequence_ Source
bisequence_ :: forall b a f t. Bifoldable t => Applicative f => t (f a) (f b) -> f Unit
Collapse a data structure, collecting effects using an Applicative
functor,
ignoring the final result.
#bifor_ Source
bifor_ :: forall d c b a f t. Bifoldable t => Applicative f => t a b -> (a -> f c) -> (b -> f d) -> f Unit
A version of bitraverse_
with the data structure as the first argument.
#bifoldrDefault Source
bifoldrDefault :: forall c b a p. Bifoldable p => (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c
A default implementation of bifoldr
using bifoldMap
.
Note: when defining a Bifoldable
instance, this function is unsafe to
use in combination with bifoldMapDefaultR
.
#bifoldlDefault Source
bifoldlDefault :: forall c b a p. Bifoldable p => (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c
A default implementation of bifoldl
using bifoldMap
.
Note: when defining a Bifoldable
instance, this function is unsafe to
use in combination with bifoldMapDefaultL
.
#bifoldMapDefaultR Source
bifoldMapDefaultR :: forall b a m p. Bifoldable p => Monoid m => (a -> m) -> (b -> m) -> p a b -> m
A default implementation of bifoldMap
using bifoldr
.
Note: when defining a Bifoldable
instance, this function is unsafe to
use in combination with bifoldrDefault
.
#bifoldMapDefaultL Source
bifoldMapDefaultL :: forall b a m p. Bifoldable p => Monoid m => (a -> m) -> (b -> m) -> p a b -> m
A default implementation of bifoldMap
using bifoldl
.
Note: when defining a Bifoldable
instance, this function is unsafe to
use in combination with bifoldlDefault
.
#bifold Source
bifold :: forall m t. Bifoldable t => Monoid m => t m m -> m
Fold a data structure, accumulating values in a monoidal type.
#biany Source
biany :: forall c b a t. Bifoldable t => BooleanAlgebra c => (a -> c) -> (b -> c) -> t a b -> c
Test whether a predicate holds at any position in a data structure.
#biall Source
biall :: forall c b a t. Bifoldable t => BooleanAlgebra c => (a -> c) -> (b -> c) -> t a b -> c
Test whether a predicate holds at all positions in a data structure.