File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed
Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -178,21 +178,23 @@ The disjunction of all the values in a data structure. When specialized
178178to ` Boolean ` , this function will test whether any of the values in a data
179179structure is ` true ` .
180180
181- #### ` any `
181+ #### ` all `
182182
183183``` purescript
184- any :: forall a b f. (Foldable f, BooleanAlgebra b) => (a -> b) -> f a -> b
184+ all :: forall a b f. (Foldable f, BooleanAlgebra b) => (a -> b) -> f a -> b
185185```
186186
187- Test whether a predicate holds for any element in a data structure.
187+ ` all f ` is the same as ` and <<< map f ` ; map a function over the structure,
188+ and then get the conjunction of the results.
188189
189- #### ` all `
190+ #### ` any `
190191
191192``` purescript
192- all :: forall a b f. (Foldable f, BooleanAlgebra b) => (a -> b) -> f a -> b
193+ any :: forall a b f. (Foldable f, BooleanAlgebra b) => (a -> b) -> f a -> b
193194```
194195
195- Test whether a predicate holds for all elements in a data structure.
196+ ` any f ` is the same as ` or <<< map f ` ; map a function over the structure,
197+ and then get the disjunction of the results.
196198
197199#### ` sum `
198200
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ module Data.Foldable
99 , intercalate
1010 , and
1111 , or
12- , any
1312 , all
13+ , any
1414 , sum
1515 , product
1616 , elem
@@ -209,14 +209,16 @@ and = all id
209209or :: forall a f . (Foldable f , BooleanAlgebra a ) => f a -> a
210210or = any id
211211
212- -- | Test whether a predicate holds for any element in a data structure.
213- any :: forall a b f . (Foldable f , BooleanAlgebra b ) => (a -> b ) -> f a -> b
214- any p = runDisj <<< foldMap (Disj <<< p)
215-
216- -- | Test whether a predicate holds for all elements in a data structure.
212+ -- | `all f` is the same as `and <<< map f`; map a function over the structure,
213+ -- | and then get the conjunction of the results.
217214all :: forall a b f . (Foldable f , BooleanAlgebra b ) => (a -> b ) -> f a -> b
218215all p = runConj <<< foldMap (Conj <<< p)
219216
217+ -- | `any f` is the same as `or <<< map f`; map a function over the structure,
218+ -- | and then get the disjunction of the results.
219+ any :: forall a b f . (Foldable f , BooleanAlgebra b ) => (a -> b ) -> f a -> b
220+ any p = runDisj <<< foldMap (Disj <<< p)
221+
220222-- | Find the sum of the numeric values in a data structure.
221223sum :: forall a f . (Foldable f , Semiring a ) => f a -> a
222224sum = foldl (+) zero
You can’t perform that action at this time.
0 commit comments