@@ -18,7 +18,7 @@ module Data.ArrayBuffer.Typed
1818 , foldlM , foldl1M , foldl , foldl1 , foldrM , foldr1M , foldr , foldr1
1919 , find , findIndex , indexOf , lastIndexOf
2020 , slice , subArray
21- , toString , toString' , toArray
21+ , toString , join , toArray
2222 ) where
2323
2424import Data.Array (length ) as A
@@ -126,7 +126,7 @@ type Length = Int
126126-- | - `indexOf` and `lastIndexOf` are searching functions via equality
127127-- | - `slice` returns a new typed array on the same array buffer content as the input
128128-- | - `subArray` returns a new typed array with a separate array buffer
129- -- | - `toString` prints to a CSV, `toString' ` allows you to supply the delimiter
129+ -- | - `toString` prints to a CSV, `join ` allows you to supply the delimiter
130130-- | - `toArray` returns an array of numeric values
131131class BinaryValue a t <= TypedArray (a :: ArrayViewType ) (t :: Type ) | a -> t where
132132 create :: forall x . EffectFn3 x (Nullable ByteOffset ) (Nullable ByteLength ) (ArrayView a )
@@ -388,18 +388,19 @@ toString a = runEffectFn1 toStringImpl a
388388foreign import joinImpl :: forall a . EffectFn2 (ArrayView a ) String String
389389
390390-- | Prints array to a delimiter-separated string - see [MDN's spec](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/join) for details.
391- toString' :: forall a . ArrayView a -> String -> Effect String
392- toString' a s = runEffectFn2 joinImpl a s
391+ join :: forall a . String -> ArrayView a -> Effect String
392+ join s a = runEffectFn2 joinImpl a s
393393
394394
395- foreign import unsafeAtImpl :: forall a b . EffectFn2 (ArrayView a ) Offset b
396-
397395foreign import hasIndexImpl :: forall a . Fn2 (ArrayView a ) Offset Boolean
398396
399397-- | Determine if a certain index is valid.
400398hasIndex :: forall a . ArrayView a -> Offset -> Boolean
401399hasIndex a o = runFn2 hasIndexImpl a o
402400
401+
402+ foreign import unsafeAtImpl :: forall a b . EffectFn2 (ArrayView a ) Offset b
403+
403404-- | Fetch element at index.
404405at :: forall a t . TypedArray a t => ArrayView a -> Offset -> Effect (Maybe t )
405406at a n = if a `hasIndex` n
0 commit comments