Skip to content

Commit 93555fd

Browse files
committed
Correct Typed slice and subArray docs
1 parent fe2b1d5 commit 93555fd

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Bugfixes:
1212

1313
Other improvements:
1414

15+
- Correct `Typed` `slice` and `subArray` docs (#51 by @jamesdbrock)
16+
1517
## [v13.1.0](https://github.com/purescript-contrib/purescript-arraybuffer/releases/tag/v13.1.0) - 2022-12-01
1618

1719
New features:

src/Data/ArrayBuffer/Typed.purs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
-- | - `foldr`, `foldrM`, `foldr1`, `foldr1M`, `foldl`, `foldlM`, `foldl1`, `foldl1M` all can reduce an array
2424
-- | - `find` and `findIndex` are searching functions via a predicate
2525
-- | - `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
26+
-- | - `slice` returns a new typed array with a new copied underlying `ArrayBuffer`
27+
-- | - `subArray` returns a new typed array view of the same `ArrayBuffer`
2828
-- | - `toString` prints to a CSV, `join` allows you to supply the delimiter
2929
-- | - `toArray` returns an array of numeric values
3030

@@ -211,7 +211,7 @@ set = setInternal A.length
211211
ap1 :: forall a b c. (a -> c) -> (a -> b -> c)
212212
ap1 f = \x _ -> f x
213213

214-
-- | Maps a new value over the typed array, creating a new buffer and
214+
-- | Maps a new value over the typed array, creating a new `ArrayBuffer` and
215215
-- | typed array as well.
216216
map :: forall a t. TypedArray a t => (t -> t) -> ArrayView a -> ArrayView a
217217
map = mapWithIndex' <<< ap1
@@ -415,7 +415,8 @@ foreign import setImpl :: forall a b. EffectFn3 (ArrayView a) Index b Unit
415415
setTyped :: forall a. ArrayView a -> Maybe Index -> ArrayView a -> Effect Boolean
416416
setTyped = setInternal length
417417

418-
-- | Copy part of the contents of a typed array into a new buffer, between some start and end indices.
418+
-- | Copy part of the contents of a typed array into a new `ArrayBuffer`,
419+
-- | between the start and end indices.
419420
slice :: forall a. Index -> Index -> ArrayView a -> Effect (ArrayView a)
420421
slice s e a = runEffectFn3 sliceImpl a s e
421422

@@ -427,7 +428,8 @@ sort a = runEffectFn1 sortImpl a
427428

428429
foreign import sortImpl :: forall a. EffectFn1 (ArrayView a) Unit
429430

430-
-- | Returns a new typed array view of the same buffer, beginning at the index and ending at the second.
431+
-- | Returns a new typed array view of the same `ArrayBuffer`, beginning at
432+
-- | the index and ending at the second.
431433
subArray :: forall a. Index -> Index -> ArrayView a -> ArrayView a
432434
subArray s e a = runFn3 subArrayImpl a s e
433435

0 commit comments

Comments
 (0)