Skip to content

Commit fc775d1

Browse files
committed
Rerun pulp docs
1 parent 03d4814 commit fc775d1

File tree

2 files changed

+43
-5
lines changed

2 files changed

+43
-5
lines changed

docs/Data/Array.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,36 @@ use cases. This module is useful when integrating with JavaScript libraries
88
which use arrays, but immutable arrays are not a practical data structure
99
for many use cases due to their poor asymptotics.
1010

11+
In addition to the functions in this module, Arrays have a number of
12+
useful instances:
13+
14+
* `Functor`, which provides `map :: forall a b. (a -> b) -> Array a ->
15+
Array b`
16+
* `Apply`, which provides `(<*>) :: forall a b. Array (a -> b) -> Array a
17+
-> Array b`. This function works a bit like a Cartesian product; the
18+
result array is constructed by applying each function in the first
19+
array to each value in the second, so that the result array ends up with
20+
a length equal to the product of the two arguments' lengths.
21+
* `Bind`, which provides `(>>=) :: forall a b. (a -> Array b) -> Array a
22+
-> Array b` (this is the same as `concatMap`).
23+
* `Semigroup`, which provides `(<>) :: forall a. Array a -> Array a ->
24+
Array a`, for concatenating arrays.
25+
* `Foldable`, which provides a slew of functions for *folding* (also known
26+
as *reducing*) arrays down to one value. For example,
27+
`Data.Foldable.any` tests whether an array of `Boolean` values contains
28+
at least one `true`.
29+
* `Traversable`, which provides the PureScript version of a for-loop,
30+
allowing you to iterate over an array and accumulate effects.
31+
32+
1133
#### `singleton`
1234

1335
``` purescript
1436
singleton :: forall a. a -> Array a
1537
```
1638

39+
Create an array of one element
40+
1741
#### `range`
1842

1943
``` purescript
@@ -453,7 +477,7 @@ specified equivalence relation to detemine equality.
453477
nub :: forall a. (Eq a) => Array a -> Array a
454478
```
455479

456-
Special case of `nubBy`: `nubBy eq`
480+
Remove the duplicates from an array, creating a new array.
457481

458482
#### `nubBy`
459483

@@ -462,8 +486,7 @@ nubBy :: forall a. (a -> a -> Boolean) -> Array a -> Array a
462486
```
463487

464488
Remove the duplicates from an array, where element equality is determined
465-
by the specified equivalence relation, creating a new array. The first
466-
occurence of an element is always the one that is kept.
489+
by the specified equivalence relation, creating a new array.
467490

468491
#### `union`
469492

@@ -537,6 +560,17 @@ relation to compare elements, creating a new array.
537560
zipWith :: forall a b c. (a -> b -> c) -> Array a -> Array b -> Array c
538561
```
539562

563+
Apply a function to pairs of elements at the same index in two arrays,
564+
collecting the results in a new array.
565+
566+
If one array is longer, elements will be discarded from the longer array.
567+
568+
For example
569+
570+
```purescript
571+
zipWith (*) [1, 2, 3] [4, 5, 6, 7] == [4, 10, 18]
572+
```
573+
540574
#### `zipWithA`
541575

542576
``` purescript
@@ -569,3 +603,7 @@ second components.
569603
``` purescript
570604
foldM :: forall m a b. (Monad m) => (a -> b -> m a) -> a -> Array b -> m a
571605
```
606+
607+
Perform a fold using a monadic step function.
608+
609+

docs/Data/Array/ST.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A reference to a mutable array.
1515
The first type parameter represents the memory region which the array belongs to.
1616
The second type parameter defines the type of elements of the mutable array.
1717

18-
The runtime representation of a value of type `STArray h a` is the same as that of `[a]`,
18+
The runtime representation of a value of type `STArray h a` is the same as that of `Array a`,
1919
except that mutation is allowed.
2020

2121
#### `Assoc`
@@ -24,7 +24,7 @@ except that mutation is allowed.
2424
type Assoc a = { value :: a, index :: Int }
2525
```
2626

27-
An element and its index
27+
An element and its index.
2828

2929
#### `runSTArray`
3030

0 commit comments

Comments
 (0)