Data.Bifoldable
#Bifoldable
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 a b c. (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c
bifoldl :: forall a b c. (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c
bifoldMap :: forall m a b. 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)
#bifoldrDefault
bifoldrDefault :: forall p a b c. 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
bifoldlDefault :: forall p a b c. 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
bifoldMapDefaultR :: forall p m a b. 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
bifoldMapDefaultL :: forall p m a b. 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
bifold :: forall t m. Bifoldable t => Monoid m => t m m -> m
Fold a data structure, accumulating values in a monoidal type.
#bitraverse_
bitraverse_ :: forall t f a b c d. 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.
#bifor_
bifor_ :: forall t f a b c d. 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.
#bisequence_
bisequence_ :: forall t f a b. 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.
#biany
biany :: forall t a b c. 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
biall :: forall t a b c. Bifoldable t => BooleanAlgebra c => (a -> c) -> (b -> c) -> t a b -> c
Test whether a predicate holds at all positions in a data structure.
Modules
- Control.Alt
- Control.Alternative
- Control.Applicative
- Control.Apply
- Control.Biapplicative
- Control.Biapply
- Control.Bind
- Control.Category
- Control.Comonad
- Control.Extend
- Control.Lazy
- Control.Monad
- Control.Monad.Gen
- Control.Monad.Gen.Class
- Control.Monad.Gen.Common
- Control.Monad.Rec.Class
- Control.Monad.ST
- Control.Monad.ST.Class
- Control.Monad.ST.Global
- Control.Monad.ST.Internal
- Control.Monad.ST.Ref
- Control.MonadPlus
- Control.MonadZero
- Control.Plus
- Control.Semigroupoid
- Data.Array
- Data.Array.NonEmpty
- Data.Array.NonEmpty.Internal
- Data.Array.Partial
- Data.Array.ST
- Data.Array.ST.Iterator
- Data.Array.ST.Partial
- Data.Bifoldable
- Data.Bifunctor
- Data.Bifunctor.Clown
- Data.Bifunctor.Flip
- Data.Bifunctor.Join
- Data.Bifunctor.Joker
- Data.Bifunctor.Product
- Data.Bifunctor.Wrap
- Data.Bitraversable
- Data.Boolean
- Data.BooleanAlgebra
- Data.Bounded
- Data.Char
- Data.Char.Gen
- Data.Char.Utils
- Data.CommutativeRing
- Data.Distributive
- Data.DivisionRing
- Data.Either
- Data.Either.Inject
- Data.Either.Nested
- Data.Enum
- Data.Enum.Gen
- Data.Eq
- Data.EuclideanRing
- Data.Field
- Data.Foldable
- Data.FoldableWithIndex
- Data.Function
- Data.Function.Uncurried
- Data.Functor
- Data.Functor.Invariant
- Data.FunctorWithIndex
- Data.HeytingAlgebra
- Data.Identity
- Data.Int
- Data.Int.Bits
- Data.Maybe
- Data.Maybe.First
- Data.Maybe.Last
- Data.Monoid
- Data.Monoid.Additive
- Data.Monoid.Alternate
- Data.Monoid.Conj
- Data.Monoid.Disj
- Data.Monoid.Dual
- Data.Monoid.Endo
- Data.Monoid.Multiplicative
- Data.NaturalTransformation
- Data.Newtype
- Data.NonEmpty
- Data.Ord
- Data.Ord.Down
- Data.Ord.Max
- Data.Ord.Min
- Data.Ord.Unsafe
- Data.Ordering
- Data.Ring
- Data.Semigroup
- Data.Semigroup.First
- Data.Semigroup.Foldable
- Data.Semigroup.Last
- Data.Semigroup.Traversable
- Data.Semiring
- Data.Show
- Data.String
- Data.String.CaseInsensitive
- Data.String.CodePoints
- Data.String.CodeUnits
- Data.String.Common
- Data.String.Gen
- Data.String.NonEmpty
- Data.String.NonEmpty.CaseInsensitive
- Data.String.NonEmpty.CodePoints
- Data.String.NonEmpty.CodeUnits
- Data.String.NonEmpty.Internal
- Data.String.Pattern
- Data.String.Regex
- Data.String.Regex.Flags
- Data.String.Regex.Unsafe
- Data.String.Unsafe
- Data.String.Utils
- Data.Symbol
- Data.Traversable
- Data.Traversable.Accum
- Data.Traversable.Accum.Internal
- Data.TraversableWithIndex
- Data.Tuple
- Data.Tuple.Nested
- Data.Unfoldable
- Data.Unfoldable1
- Data.Unit
- Data.Void
- Effect
- Effect.Class
- Effect.Class.Console
- Effect.Console
- Effect.Ref
- Effect.Uncurried
- Effect.Unsafe
- Global
- Global.Unsafe
- MCPrelude
- Main
- Math
- PSCI.Support
- Partial
- Partial.Unsafe
- Prelude
- Prim
- Prim.Boolean
- Prim.Ordering
- Prim.Row
- Prim.RowList
- Prim.Symbol
- Prim.TypeError
- Record.Unsafe
- Type.Data.Row
- Type.Data.RowList
- Type.Equality
- Unsafe.Coerce