@@ -9,6 +9,8 @@ class (Biapply w) <= Biapplicative w where
99 bipure :: forall a b. a -> b -> w a b
1010```
1111
12+ ` Biapplicative ` captures type constructors of two arguments which support lifting of
13+ functions of zero or more arguments, in the sense of ` Applicative ` .
1214
1315#### ` biapplicativeTuple `
1416
@@ -33,6 +35,12 @@ instance biapplicativeConst :: Biapplicative Const
3335(<<$>>) :: forall a b. (a -> b) -> a -> b
3436```
3537
38+ A convenience function which can be used to apply the result of ` bipure ` in
39+ the style of ` Applicative ` :
40+
41+ ``` purescript
42+ bipure f g <<$>> x <<*>> y
43+ ```
3644
3745#### ` Biapply `
3846
@@ -41,34 +49,40 @@ class (Bifunctor w) <= Biapply w where
4149 (<<*>>) :: forall a b c d. w (a -> b) (c -> d) -> w a c -> w b d
4250```
4351
52+ ` Biapply ` captures type constructors of two arguments which support lifting of
53+ functions of one or more arguments, in the sense of ` Apply ` .
4454
4555#### ` (*>>) `
4656
4757``` purescript
4858(*>>) :: forall w a b c d. (Biapply w) => w a b -> w c d -> w c d
4959```
5060
61+ Keep the results of the second computation
5162
5263#### ` (<<*) `
5364
5465``` purescript
5566(<<*) :: forall w a b c d. (Biapply w) => w a b -> w c d -> w a b
5667```
5768
69+ Keep the results of the first computation
5870
5971#### ` bilift2 `
6072
6173``` purescript
6274bilift2 :: forall w a b c d e f. (Biapply w) => (a -> b -> c) -> (d -> e -> f) -> w a d -> w b e -> w c f
6375```
6476
77+ Lift a function of two arguments.
6578
6679#### ` bilift3 `
6780
6881``` purescript
6982bilift3 :: forall w a b c d e f g h. (Biapply w) => (a -> b -> c -> d) -> (e -> f -> g -> h) -> w a e -> w b f -> w c g -> w d h
7083```
7184
85+ Lift a function of three arguments.
7286
7387#### ` biapplyTuple `
7488
@@ -96,6 +110,13 @@ class Bifoldable p where
96110 bifoldMap :: forall m a b. (Monoid m) => (a -> m) -> (b -> m) -> p a b -> m
97111```
98112
113+ ` Bifoldable ` represents data structures with two type arguments which can be
114+ folded.
115+
116+ A fold for such a structure requires two step functions, one for each type
117+ argument. Type class instances should choose the appropriate step function based
118+ on the type of the element encountered at each point of the fold.
119+
99120
100121#### ` bifoldableTuple `
101122
@@ -124,41 +145,49 @@ instance bifoldableConst :: Bifoldable Const
124145bifold :: forall t m. (Bifoldable t, Monoid m) => t m m -> m
125146```
126147
148+ Fold a data structure, accumulating values in a monoidal type.
127149
128150#### ` bitraverse_ `
129151
130152``` purescript
131153bitraverse_ :: forall t f a b c d. (Bifoldable t, Applicative f) => (a -> f c) -> (b -> f d) -> t a b -> f Unit
132154```
133155
156+ Traverse a data structure, accumulating effects using an ` Applicative ` functor,
157+ ignoring the final result.
134158
135159#### ` bifor_ `
136160
137161``` purescript
138162bifor_ :: forall t f a b c d. (Bifoldable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f Unit
139163```
140164
165+ A version of ` bitraverse_ ` with the data structure as the first argument.
141166
142167#### ` bisequence_ `
143168
144169``` purescript
145170bisequence_ :: forall t f a b. (Bifoldable t, Applicative f) => t (f a) (f b) -> f Unit
146171```
147172
173+ Collapse a data structure, collecting effects using an ` Applicative ` functor,
174+ ignoring the final result.
148175
149176#### ` biany `
150177
151178``` purescript
152179biany :: forall t a b. (Bifoldable t) => (a -> Boolean) -> (b -> Boolean) -> t a b -> Boolean
153180```
154181
182+ Test whether a predicate holds at any position in a data structure.
155183
156184#### ` biall `
157185
158186``` purescript
159187biall :: forall t a b. (Bifoldable t) => (a -> Boolean) -> (b -> Boolean) -> t a b -> Boolean
160188```
161189
190+ Test whether a predicate holds at all positions in a data structure.
162191
163192
164193## Module Data.Bifunctor
@@ -170,20 +199,35 @@ class Bifunctor f where
170199 bimap :: forall a b c d. (a -> b) -> (c -> d) -> f a c -> f b d
171200```
172201
202+ A ` Bifunctor ` is a ` Functor ` from the pair category ` (Type, Type) ` to ` Type ` .
203+
204+ A type constructor with two type arguments can be made into a ` Bifunctor ` if
205+ both of its type arguments are covariant.
206+
207+ The ` bimap ` function maps a pair of functions over the two type arguments
208+ of the bifunctor.
209+
210+ Laws:
211+
212+ - Identity: ` bimap id id == id `
213+ - Composition: ` bimap f1 g1 <<< bimap f2 g2 == bimap (f1 <<< f2) (g1 <<< g2) `
214+
173215
174216#### ` lmap `
175217
176218``` purescript
177219lmap :: forall f a b c. (Bifunctor f) => (a -> b) -> f a c -> f b c
178220```
179221
222+ Map a function over the first type argument of a ` Bifunctor ` .
180223
181224#### ` rmap `
182225
183226``` purescript
184227rmap :: forall f a b c. (Bifunctor f) => (b -> c) -> f a b -> f a c
185228```
186229
230+ Map a function over the second type component of a ` Bifunctor ` .
187231
188232#### ` bifunctorEither `
189233
@@ -290,13 +334,16 @@ data Flip p a b
290334 = Flip (p b a)
291335```
292336
337+ Flips the order of the type arguments of a ` Bifunctor ` , creating a
338+ ` Functor ` instance for the first type argument.
293339
294340#### ` runFlip `
295341
296342``` purescript
297343runFlip :: forall p a b. Flip p a b -> p b a
298344```
299345
346+ Remove the ` Flip ` constructor.
300347
301348#### ` flipBifunctor `
302349
@@ -364,13 +411,16 @@ data Join p a
364411 = Join (p a a)
365412```
366413
414+ ` Join ` turns a ` Bifunctor ` into a ` Functor ` by equating the
415+ two type arguments.
367416
368417#### ` runJoin `
369418
370419``` purescript
371420runJoin :: forall p a. Join p a -> p a a
372421```
373422
423+ Remove the ` Join ` constructor.
374424
375425#### ` joinFunctor `
376426
@@ -491,6 +541,7 @@ data Product f g a b
491541 = Pair (f a b) (g a b)
492542```
493543
544+ The product of two ` Bifunctor ` s.
494545
495546#### ` productBifunctor `
496547
@@ -536,13 +587,16 @@ data Wrap p a b
536587 = Wrap (p a b)
537588```
538589
590+ A ` newtype ` wrapper which provides default ` Functor ` , ` Foldable ` and ` Traversable `
591+ type class instances for ` Bifunctor ` s.
539592
540593#### ` unwrap `
541594
542595``` purescript
543596unwrap :: forall p a b. Wrap p a b -> p a b
544597```
545598
599+ Remove the ` Wrap ` constructor.
546600
547601#### ` wrapBifunctor `
548602
@@ -611,6 +665,13 @@ class (Bifunctor t, Bifoldable t) <= Bitraversable t where
611665 bisequence :: forall f a b. (Applicative f) => t (f a) (f b) -> f (t a b)
612666```
613667
668+ ` Bitraversable ` represents data structures with two type arguments which can be
669+ traversed.
670+
671+ A traversal for such a structure requires two functions, one for each type
672+ argument. Type class instances should choose the appropriate function based
673+ on the type of the element encountered at each point of the traversal.
674+
614675
615676#### ` bitraversableTuple `
616677
@@ -637,4 +698,6 @@ instance bitraversableConst :: Bitraversable Const
637698
638699``` purescript
639700bifor :: forall t f a b c d. (Bitraversable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f (t c d)
640- ```
701+ ```
702+
703+ Traverse a data structure, accumulating effects and results using an ` Applicative ` functor.
0 commit comments