Data.ArrayBuffer.Typed
- Package
- purescript-arraybuffer
- Repository
- jacereda/purescript-arraybuffer
This module represents the functional bindings to JavaScript's TypedArray and other
objects. See MDN's spec for details.
Creation
whole,remainder, andpartare functions for building a typed array accessible interface on top of an existingArrayBufferemptyandfromArrayare functions for creating pure typed arrays
Modification
fill,set, andsetTypedare functions for assigning values from external sourcesmapandtraverseallow you to create a new array from the existing values in anothercopyWithinallows you to set values to the array that exist in other parts of the arrayfiltercreates a new array without the values that don't pass a predicatereversemodifies an existing array in-place, with all values reversedsortmodifies an existing array in-place, with all values sorted
Access
elem,all, andanyare functions for testing the contents of an arrayunsafeAt,hasIndex, andatare used to get values from an array, with an indexfoldr,foldrM,foldr1,foldr1M,foldl,foldlM,foldl1,foldl1Mall can reduce an arrayfindandfindIndexare searching functions via a predicateindexOfandlastIndexOfare searching functions via equalityslicereturns a new typed array on the same array buffer content as the inputsubArrayreturns a new typed array with a separate array buffertoStringprints to a CSV,joinallows you to supply the delimitertoArrayreturns an array of numeric values
#buffer Source
buffer :: forall a. ArrayView a -> ArrayBufferArrayBuffer being mapped by the typed array.
#byteOffset Source
byteOffset :: forall a. ArrayView a -> ByteOffsetRepresents the offset of this view from the start of its ArrayBuffer.
#byteLength Source
byteLength :: forall a. ArrayView a -> ByteLengthRepresents the length of this typed array, in bytes.
#TypedArray Source
class (BinaryValue a t) <= TypedArray (a :: ArrayViewType) (t :: Type) | a -> t whereMembers
create :: forall x. EffectFn3 x (Nullable ByteOffset) (Nullable ByteLength) (ArrayView a)
Instances
#whole Source
whole :: forall t a. TypedArray a t => ArrayBuffer -> Effect (ArrayView a)View mapping the whole ArrayBuffer.
#remainder Source
remainder :: forall t b a. TypedArray a t => Nat b => BytesPerValue a b => ArrayBuffer -> Index -> Effect (ArrayView a)View mapping the rest of an ArrayBuffer after an index.
#part Source
part :: forall t b a. TypedArray a t => Nat b => BytesPerValue a b => ArrayBuffer -> Index -> Length -> Effect (ArrayView a)View mapping a region of the ArrayBuffer.
#empty Source
empty :: forall t a. TypedArray a t => Length -> Effect (ArrayView a)Creates an empty typed array, where each value is assigned 0.
#fromArray Source
fromArray :: forall t a. TypedArray a t => Array t -> Effect (ArrayView a)Creates a typed array from an input array of values, to be binary serialized.
#copyWithin Source
copyWithin :: forall a. ArrayView a -> Index -> Index -> Maybe Index -> Effect UnitInternally copy values - see MDN's spec for details.
#map Source
map :: forall t a. TypedArray a t => (t -> t) -> ArrayView a -> ArrayView aMaps a new value over the typed array, creating a new buffer and typed array as well.
#mapWithIndex Source
mapWithIndex :: forall t a. TypedArray a t => (Index -> t -> t) -> ArrayView a -> ArrayView aApply a function to each element in an array, supplying a generated zero-based index integer along with the element, creating a typed array with the new elements.
#traverseWithIndex Source
traverseWithIndex :: forall t a. TypedArray a t => (Index -> t -> Effect t) -> ArrayView a -> Effect (ArrayView a)Traverses over each value, returning a new one.
#traverseWithIndex_ Source
traverseWithIndex_ :: forall t a. TypedArray a t => (Index -> t -> Effect Unit) -> ArrayView a -> Effect UnitTraverses over each value.
#filterWithIndex Source
filterWithIndex :: forall t a. TypedArray a t => (Index -> t -> Boolean) -> ArrayView a -> Effect (ArrayView a)Returns a new typed array with all values that pass the predicate. The predicate function receives the index and the element.
#allWithIndex Source
allWithIndex :: forall t a. TypedArray a t => (Index -> t -> Boolean) -> ArrayView a -> Effect BooleanTest a predicate to pass on all values. The predicate function receives the index and the element.
#anyWithIndex Source
anyWithIndex :: forall t a. TypedArray a t => (Index -> t -> Boolean) -> ArrayView a -> Effect BooleanTest a predicate (that receives also an index) to pass on any value.
#foldl Source
foldl :: forall t b a. TypedArray a t => (b -> t -> b) -> b -> ArrayView a -> Effect bFold a list from the left, accumulating the result using the specified function.
#foldl1 Source
foldl1 :: forall t a. Partial => TypedArray a t => (t -> t -> t) -> ArrayView a -> Effect tFolding from the left. Assumes the typed array is non-empty.
#reduceRight Source
reduceRight :: forall b t a. TypedArray a t => (t -> b -> Index -> Effect b) -> b -> ArrayView a -> Effect bFolding from the right.
#reduceRight1 Source
reduceRight1 :: forall t a. Partial => TypedArray a t => (t -> t -> Index -> Effect t) -> ArrayView a -> Effect tFolding from the right. Assumes the typed array is non-empty.
#foldr Source
foldr :: forall t b a. TypedArray a t => (t -> b -> b) -> b -> ArrayView a -> Effect bFold a list from the right, accumulating the result using the specified function.
#foldr1 Source
foldr1 :: forall t a. Partial => TypedArray a t => (t -> t -> t) -> ArrayView a -> Effect tFolding from the right. Assumes the typed array is non-empty.
#lastIndexOf Source
lastIndexOf :: forall t a. TypedArray a t => t -> Maybe Index -> ArrayView a -> Effect (Maybe Index)Returns the first index of the element, if it exists, from the right.
#toString Source
toString :: forall a. ArrayView a -> Effect StringPrints array to a comma-separated string - see MDN's spec for details.