|
1 | 1 | -- | This module represents the functional bindings to JavaScript's `TypedArray` and other
|
2 | 2 | -- | objects. See [MDN's spec](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) for details.
|
| 3 | +-- | |
| 4 | +-- | #### Creation |
| 5 | +-- | |
| 6 | +-- | - `whole`, `remainder`, and `part` are functions for building a typed array accessible interface |
| 7 | +-- | on top of an existing `ArrayBuffer` |
| 8 | +-- | - `empty` and `fromArray` are functions for creating pure typed arrays |
| 9 | +-- | |
| 10 | +-- | #### Modification |
| 11 | +-- | |
| 12 | +-- | - `fill`, `set`, and `setTyped` are functions for assigning values from external sources |
| 13 | +-- | - `map` and `traverse` allow you to create a new array from the existing values in another |
| 14 | +-- | - `copyWithin` allows you to set values to the array that exist in other parts of the array |
| 15 | +-- | - `filter` creates a new array without the values that don't pass a predicate |
| 16 | +-- | - `reverse` modifies an existing array in-place, with all values reversed |
| 17 | +-- | - `sort` modifies an existing array in-place, with all values sorted |
| 18 | +-- | |
| 19 | +-- | #### Access |
| 20 | +-- | |
| 21 | +-- | - `elem`, `all`, and `any` are functions for testing the contents of an array |
| 22 | +-- | - `unsafeAt`, `hasIndex`, and `at` are used to get values from an array, with an offset |
| 23 | +-- | - `foldr`, `foldrM`, `foldr1`, `foldr1M`, `foldl`, `foldlM`, `foldl1`, `foldl1M` all can reduce an array |
| 24 | +-- | - `find` and `findIndex` are searching functions via a predicate |
| 25 | +-- | - `indexOf` and `lastIndexOf` are searching functions via equality |
| 26 | +-- | - `slice` returns a new typed array on the same array buffer content as the input |
| 27 | +-- | - `subArray` returns a new typed array with a separate array buffer |
| 28 | +-- | - `toString` prints to a CSV, `join` allows you to supply the delimiter |
| 29 | +-- | - `toArray` returns an array of numeric values |
| 30 | + |
3 | 31 |
|
4 | 32 | module Data.ArrayBuffer.Typed
|
5 | 33 | ( polyFill
|
@@ -96,38 +124,6 @@ type Offset = Int
|
96 | 124 | type Length = Int
|
97 | 125 |
|
98 | 126 |
|
99 |
| --- TODO use purescript-quotient |
100 |
| --- | Typeclass that associates a measured user-level type with a typed array. |
101 |
| --- | |
102 |
| --- | #### Creation |
103 |
| --- | |
104 |
| --- | - `whole`, `remainder`, and `part` are methods for building a typed array accessible interface |
105 |
| --- | on top of an existing `ArrayBuffer` - Note, `part` and `remainder` may behave unintuitively - |
106 |
| --- | when the operation is isomorphic to `whole`, the new TypedArray uses the same buffer as the input, |
107 |
| --- | but not when the portion is a sub-array of the original buffer, a new one is made with |
108 |
| --- | `Data.ArrayBuffer.ArrayBuffer.slice`. |
109 |
| --- | - `empty` and `fromArray` are methods for creating pure typed arrays |
110 |
| --- | |
111 |
| --- | #### Modification |
112 |
| --- | |
113 |
| --- | - `fill`, `set`, and `setTyped` are methods for assigning values from external sources |
114 |
| --- | - `map` and `traverse` allow you to create a new array from the existing values in another |
115 |
| --- | - `copyWithin` allows you to set values to the array that exist in other parts of the array |
116 |
| --- | - `filter` creates a new array without the values that don't pass a predicate |
117 |
| --- | - `reverse` modifies an existing array in-place, with all values reversed |
118 |
| --- | - `sort` modifies an existing array in-place, with all values sorted |
119 |
| --- | |
120 |
| --- | #### Access |
121 |
| --- | |
122 |
| --- | - `elem`, `all`, and `any` are functions for testing the contents of an array |
123 |
| --- | - `unsafeAt`, `hasIndex`, and `at` are used to get values from an array, with an offset |
124 |
| --- | - `foldr`, `foldrM`, `foldr1`, `foldr1M`, `foldl`, `foldlM`, `foldl1`, `foldl1M` all can reduce an array |
125 |
| --- | - `find` and `findIndex` are searching functions via a predicate |
126 |
| --- | - `indexOf` and `lastIndexOf` are searching functions via equality |
127 |
| --- | - `slice` returns a new typed array on the same array buffer content as the input |
128 |
| --- | - `subArray` returns a new typed array with a separate array buffer |
129 |
| --- | - `toString` prints to a CSV, `join` allows you to supply the delimiter |
130 |
| --- | - `toArray` returns an array of numeric values |
131 | 127 | class BinaryValue a t <= TypedArray (a :: ArrayViewType) (t :: Type) | a -> t where
|
132 | 128 | create :: forall x. EffectFn3 x (Nullable ByteOffset) (Nullable ByteLength) (ArrayView a)
|
133 | 129 |
|
|
0 commit comments