Module

# Data.Bifoldable

Package
purescript-foldable-traversable
Repository
purescript/purescript-foldable-traversable

### #BifoldableSource

``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 (Product2 f g)`
• `Bifoldable Either`
• `Bifoldable Tuple`
• `Bifoldable Const`

### #bifoldrDefaultSource

``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`.

### #bifoldlDefaultSource

``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`.

### #bifoldMapDefaultRSource

``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`.

### #bifoldMapDefaultLSource

``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`.

### #bifoldSource

``bifold :: forall t m. Bifoldable t => Monoid m => t m m -> m``

Fold a data structure, accumulating values in a monoidal type.

### #bitraverse_Source

``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_Source

``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_Source

``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.

### #bianySource

``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.

### #biallSource

``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.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6287985,"math_prob":0.8323411,"size":3540,"snap":"2022-40-2023-06","text_gpt3_token_len":1045,"char_repetition_ratio":0.19966063,"word_repetition_ratio":0.4532925,"special_character_ratio":0.28531075,"punctuation_ratio":0.12082671,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99150336,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-02-03T07:36:26Z\",\"WARC-Record-ID\":\"<urn:uuid:f0fa20cc-f2a7-40b7-85a7-9ed64855c135>\",\"Content-Length\":\"31367\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:990088c4-e5f9-4525-bd3a-41ae8919b7b4>\",\"WARC-Concurrent-To\":\"<urn:uuid:1293dc78-4d14-4f67-82af-0fbe38f8b16f>\",\"WARC-IP-Address\":\"206.189.189.151\",\"WARC-Target-URI\":\"https://pursuit.purescript.org/packages/purescript-foldable-traversable/5.0.1/docs/Data.Bifoldable\",\"WARC-Payload-Digest\":\"sha1:CU4N2B62AHFSXWQGQ5IQPGFKZULUJQIT\",\"WARC-Block-Digest\":\"sha1:BCB5BZBALXUNKIBR2W6OFUVEODKI3HPQ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764500044.16_warc_CC-MAIN-20230203055519-20230203085519-00225.warc.gz\"}"}