|
5 | 5 | -- | use cases. This module is useful when integrating with JavaScript libraries |
6 | 6 | -- | which use arrays, but immutable arrays are not a practical data structure |
7 | 7 | -- | for many use cases due to their poor asymptotics. |
| 8 | +-- | |
| 9 | +-- | In addition to the functions in this module, Arrays have a number of |
| 10 | +-- | useful instances: |
| 11 | +-- | |
| 12 | +-- | * `Functor`, which provides `map :: forall a b. (a -> b) -> Array a -> |
| 13 | +-- | Array b` |
| 14 | +-- | * `Apply`, which provides `(<*>) :: forall a b. Array (a -> b) -> Array a |
| 15 | +-- | -> Array b`. This function works a bit like a Cartesian product; the |
| 16 | +-- | result array is constructed by applying each function in the first |
| 17 | +-- | array to each value in the second, so that the result array ends up with |
| 18 | +-- | a length equal to the product of the two arguments' lengths. |
| 19 | +-- | * `Bind`, which provides `(>>=) :: forall a b. (a -> Array b) -> Array a |
| 20 | +-- | -> Array b` (this is the same as `concatMap`). |
| 21 | +-- | * `Semigroup`, which provides `(<>) :: forall a. Array a -> Array a -> |
| 22 | +-- | Array a`, for concatenating arrays. |
| 23 | +-- | * `Foldable`, which provides a slew of functions for *folding* (also known |
| 24 | +-- | as *reducing*) arrays down to one value. For example, |
| 25 | +-- | `Data.Foldable.any` tests whether an array of `Boolean` values contains |
| 26 | +-- | at least one `true`. |
| 27 | +-- | * `Traversable`, which provides the PureScript version of a for-loop, |
| 28 | +-- | allowing you to iterate over an array and accumulate effects. |
| 29 | +-- | |
8 | 30 | module Data.Array |
9 | 31 | ( singleton |
10 | 32 | , (..), range |
|
0 commit comments