[ { "name": "MutableJsTypedArray", "comment": " Experimental module for mutating operations on typed arrays.\n\n@docs MutableJsTypedArray\n\n@docs unsafeSetAt, unsafeSet\n\n", "aliases": [ { "name": "MutableJsTypedArray", "comment": " Mutable typed array.\n", "args": [ "a", "b" ], "type": "JsTypedArray.JsTypedArray a b" } ], "types": [], "values": [ { "name": "unsafeSet", "comment": " Set values of typed array according to given function of element index.\n", "type": "(Int -> b) -> MutableJsTypedArray.MutableJsTypedArray a b -> MutableJsTypedArray.MutableJsTypedArray a b" }, { "name": "unsafeSetAt", "comment": " Set value of typed array at given position.\n", "type": "Int -> b -> MutableJsTypedArray.MutableJsTypedArray a b -> MutableJsTypedArray.MutableJsTypedArray a b" } ], "generated-with-elm-version": "0.18.0" }, { "name": "JsUint8Array", "comment": " Provides functions to initialize JavaScript [`Uint8Array`][Uint8Array].\n\nThose functions return arrays of type `JsTypedArray Uint8 Int`\nthat can then be manipulated with the `JsTypedArray` module.\n\n[Uint8Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array\n\n@docs zeros, repeat, initialize, fromBuffer, fromArray, fromList, fromTypedArray, fromValue, decode\n\n@docs unsafeIndexedFromList\n\n", "aliases": [], "types": [], "values": [ { "name": "decode", "comment": " `JsTypedArray Uint8 Int` decoder.\n", "type": "Json.Decode.Decoder (JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int)" }, { "name": "fromArray", "comment": " Create a typed array from an elm Array.\n\nComplexity: O(length)\n\n JsUint8Array.fromArray (Array.repeat 3 42)\n --> { 0 = 42, 1 = 42, 2 = 42 }\n\n", "type": "Array.Array Int -> JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int" }, { "name": "fromBuffer", "comment": " Initialize an array from a buffer at a given offset (in bytes), of a given length.\nInternally uses `new Uint8Array( buffer, byteOffset, length )`.\n\nComplexity: O(1).\n\n JsArrayBuffer.zeros 5\n |> JsUint8Array.fromBuffer 0 3\n --> Ok { 0 = 0, 1 = 0, 2 = 0 }\n\n JsArrayBuffer.zeros 5\n |> JsUint8Array.fromBuffer -1 3\n --> Err \"Negative offset: -1\"\n\n JsArrayBuffer.zeros 5\n |> JsUint8Array.fromBuffer 0 -2\n --> Err \"Negative length: -2\"\n\n JsArrayBuffer.zeros 5\n |> JsUint8Array.fromBuffer 3 4\n --> Err \"Overflows buffer size (5 bytes)\"\n\n JsArrayBuffer.zeros 5\n |> JsUint8Array.fromBuffer 3 2\n --> Ok { 0 = 0, 1 = 0 }\n\n", "type": "Int -> Int -> JsArrayBuffer.JsArrayBuffer -> Result.Result String (JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int)" }, { "name": "fromList", "comment": " Initialize from a list of integers.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n --> { 0 = 0, 1 = 14, 2 = 42 }\n\n", "type": "List Int -> JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int" }, { "name": "fromTypedArray", "comment": " Convert from another typed array.\nNumbers are truncated, not rounded.\n\nComplexity: O(length).\n\n JsFloat64Array.fromList [0, -1.6, 14.66, 257]\n |> JsUint8Array.fromTypedArray\n --> { 0 = 0, 1 = 255, 2 = 14, 3 = 1 } : JsTypedArray Uint8 Int\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int" }, { "name": "fromValue", "comment": " Transform a compatible JavaScript value into a typed array.\nReturns Nothing in value is not a Uint8Array.\n", "type": "Json.Decode.Value -> Maybe.Maybe (JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int)" }, { "name": "initialize", "comment": " Initialize an array applying a function to each index.\n\nComplexity: O(length).\n\n JsUint8Array.initialize 3 (\\n -> n * n)\n --> { 0 = 0, 1 = 1, 2 = 4 } : JsTypedArray Uint8 Int\n\n", "type": "Int -> (Int -> Int) -> JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int" }, { "name": "repeat", "comment": " Initialize an array of a given length with the same constant.\n\nComplexity: O(length).\n\n JsUint8Array.repeat 3 42\n --> { 0 = 42, 1 = 42, 2 = 42 } : JsTypedArray Uint8 Int\n\n", "type": "Int -> Int -> JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int" }, { "name": "unsafeIndexedFromList", "comment": " Initialize from a list of elements (unsafe).\nThe array length is provided as a parameter to\navoid one walk through the list.\nIndex of current element in the list can also be used.\n\nComplexity: O(length).\n\n JsUint8Array.unsafeIndexedFromList 3 (+) [ 0, 14, 42 ]\n --> { 0 = 0, 1 = 15, 2 = 44 }\n\n", "type": "Int -> (Int -> a -> Int) -> List a -> JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int" }, { "name": "zeros", "comment": " Initialize an array of zeros of a given length.\nInternally uses `new Uint8Array( length )`.\nThis is the fastest way of initializing an array of zeros.\n\nComplexity: O(length).\n\n JsUint8Array.zeros 3\n --> { 0 = 0, 1 = 0, 2 = 0 } : JsTypedArray Uint8 Int\n\n", "type": "Int -> JsTypedArray.JsTypedArray JsTypedArray.Uint8 Int" } ], "generated-with-elm-version": "0.18.0" }, { "name": "JsFloat64Array", "comment": " Provides functions to initialize JavaScript [`Float64Array`][Float64Array].\n\nThose functions return arrays of type `JsTypedArray Float64 Float`\nthat can then be manipulated with the `JsTypedArray` module.\n\n[Float64Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array\n\n@docs zeros, repeat, initialize, fromBuffer, fromArray, fromList, fromTypedArray, fromValue, decode\n\n@docs unsafeIndexedFromList\n\n", "aliases": [], "types": [], "values": [ { "name": "decode", "comment": " `JsTypedArray Float64 Float` decoder.\n", "type": "Json.Decode.Decoder (JsTypedArray.JsTypedArray JsTypedArray.Float64 Float)" }, { "name": "fromArray", "comment": " Create a typed array from an elm Array.\n\nComplexity: O(length)\n\n JsFloat64Array.fromArray (Array.repeat 3 0.42)\n --> { 0 = 0.42, 1 = 0.42, 2 = 0.42 }\n\n", "type": "Array.Array Float -> JsTypedArray.JsTypedArray JsTypedArray.Float64 Float" }, { "name": "fromBuffer", "comment": " Initialize an array from a buffer at a given offset (in bytes), of a given length.\nInternally uses `new Float64Array( buffer, byteOffset, length )`.\n\nComplexity: O(1).\n\n JsArrayBuffer.zeros (3 * 8)\n |> JsFloat64Array.fromBuffer 0 3\n --> Ok { 0 = 0, 1 = 0, 2 = 0 }\n\n JsArrayBuffer.zeros (3 * 8)\n |> JsFloat64Array.fromBuffer -1 3\n --> Err \"Negative offset: -1\"\n\n JsArrayBuffer.zeros (3 * 8)\n |> JsFloat64Array.fromBuffer 0 -2\n --> Err \"Negative length: -2\"\n\n JsArrayBuffer.zeros (3 * 8)\n |> JsFloat64Array.fromBuffer 1 2\n --> Err \"Provided offset (1) not a multiple of element size in bytes (8)\"\n\n JsArrayBuffer.zeros (3 * 8)\n |> JsFloat64Array.fromBuffer (1*8) 3\n --> Err \"Overflows buffer size (24 bytes)\"\n\n JsArrayBuffer.zeros (3 * 8)\n |> JsFloat64Array.fromBuffer (1*8) 2\n --> Ok { 0 = 0, 1 = 0 }\n\n", "type": "Int -> Int -> JsArrayBuffer.JsArrayBuffer -> Result.Result String (JsTypedArray.JsTypedArray JsTypedArray.Float64 Float)" }, { "name": "fromList", "comment": " Initialize from a list of floats.\n\nComplexity: O(length).\n\n JsFloat64Array.fromList [0.5, 14.5, 42.5]\n --> { 0 = 0.5, 1 = 14.5, 2 = 42.5 }\n\n", "type": "List Float -> JsTypedArray.JsTypedArray JsTypedArray.Float64 Float" }, { "name": "fromTypedArray", "comment": " Convert from another typed array.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsFloat64Array.fromTypedArray\n --> { 0 = 0, 1 = 14, 2 = 42 } : JsTypedArray Float64 Float\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray JsTypedArray.Float64 Float" }, { "name": "fromValue", "comment": " Transform a compatible JavaScript value into a typed array.\nReturns Nothing in value is not a Float64Array.\n", "type": "Json.Decode.Value -> Maybe.Maybe (JsTypedArray.JsTypedArray JsTypedArray.Float64 Float)" }, { "name": "initialize", "comment": " Initialize an array applying a function to each index.\n\nComplexity: O(length).\n\n JsFloat64Array.initialize 3 (\\n -> n * n)\n --> { 0 = 0, 1 = 1, 2 = 4 } : JsTypedArray Float64 Float\n\n", "type": "Int -> (Int -> Float) -> JsTypedArray.JsTypedArray JsTypedArray.Float64 Float" }, { "name": "repeat", "comment": " Initialize an array of a given length with the same constant.\n\nComplexity: O(length).\n\n JsFloat64Array.repeat 3 42\n --> { 0 = 42, 1 = 42, 2 = 42 } : JsTypedArray Float64 Float\n\n", "type": "Int -> Float -> JsTypedArray.JsTypedArray JsTypedArray.Float64 Float" }, { "name": "unsafeIndexedFromList", "comment": " Initialize from a list of elements (unsafe).\nThe array length is provided as a parameter to\navoid one walk through the list.\nIndex of current element in the list can also be used.\n\nComplexity: O(length).\n\n indexPlusInt index int =\n toFloat (index + int)\n\n intList =\n [ 0, 14, 42 ]\n\n JsFloat64Array.unsafeIndexedFromList 3 indexPlusInt intList\n --> { 0 = 0, 1 = 15, 2 = 44 }\n\n", "type": "Int -> (Int -> a -> Float) -> List a -> JsTypedArray.JsTypedArray JsTypedArray.Float64 Float" }, { "name": "zeros", "comment": " Initialize an array of zeros of a given length.\nInternally uses `new Float64Array( length )`.\n\nComplexity: O(length).\n\n JsFloat64Array.zeros 3\n --> { 0 = 0, 1 = 0, 2 = 0 } : JsTypedArray Float64 Float\n\n", "type": "Int -> JsTypedArray.JsTypedArray JsTypedArray.Float64 Float" } ], "generated-with-elm-version": "0.18.0" }, { "name": "JsFloat32Array", "comment": " Provides functions to initialize JavaScript [`Float32Array`][Float32Array].\n\nThose functions return arrays of type `JsTypedArray Float32 Float`\nthat can then be manipulated with the `JsTypedArray` module.\n\n[Float32Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array\n\n@docs zeros, repeat, initialize, fromBuffer, fromArray, fromList, fromTypedArray, fromValue, decode\n\n@docs unsafeIndexedFromList\n\n", "aliases": [], "types": [], "values": [ { "name": "decode", "comment": " `JsTypedArray Float32 Float` decoder.\n", "type": "Json.Decode.Decoder (JsTypedArray.JsTypedArray JsTypedArray.Float32 Float)" }, { "name": "fromArray", "comment": " Create a typed array from an elm Array.\n\nComplexity: O(length)\n\n JsFloat32Array.fromArray (Array.repeat 3 0.42)\n --> { 0 = 0.42, 1 = 0.42, 2 = 0.42 }\n\n", "type": "Array.Array Float -> JsTypedArray.JsTypedArray JsTypedArray.Float32 Float" }, { "name": "fromBuffer", "comment": " Initialize an array from a buffer at a given offset (in bytes), of a given length.\nInternally uses `new Float32Array( buffer, byteOffset, length )`.\n\nComplexity: O(1).\n\n JsArrayBuffer.zeros (3 * 4)\n |> JsFloat32Array.fromBuffer 0 3\n --> Ok { 0 = 0, 1 = 0, 2 = 0 }\n\n JsArrayBuffer.zeros (3 * 4)\n |> JsFloat32Array.fromBuffer -1 3\n --> Err \"Negative offset: -1\"\n\n JsArrayBuffer.zeros (3 * 4)\n |> JsFloat32Array.fromBuffer 0 -2\n --> Err \"Negative length: -2\"\n\n JsArrayBuffer.zeros (3 * 4)\n |> JsFloat32Array.fromBuffer 1 2\n --> Err \"Provided offset (1) not a multiple of element size in bytes (4)\"\n\n JsArrayBuffer.zeros (3 * 4)\n |> JsFloat32Array.fromBuffer (1*4) 3\n --> Err \"Overflows buffer size (24 bytes)\"\n\n JsArrayBuffer.zeros (3 * 4)\n |> JsFloat32Array.fromBuffer (1*4) 2\n --> Ok { 0 = 0, 1 = 0 }\n\n", "type": "Int -> Int -> JsArrayBuffer.JsArrayBuffer -> Result.Result String (JsTypedArray.JsTypedArray JsTypedArray.Float32 Float)" }, { "name": "fromList", "comment": " Initialize from a list of floats.\n\nComplexity: O(length).\n\n JsFloat32Array.fromList [0.5, 14.5, 42.5]\n --> { 0 = 0.5, 1 = 14.5, 2 = 42.5 }\n\n", "type": "List Float -> JsTypedArray.JsTypedArray JsTypedArray.Float32 Float" }, { "name": "fromTypedArray", "comment": " Convert from another typed array.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsFloat32Array.fromTypedArray\n --> { 0 = 0, 1 = 14, 2 = 42 } : JsTypedArray Float32 Float\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray JsTypedArray.Float32 Float" }, { "name": "fromValue", "comment": " Transform a compatible JavaScript value into a typed array.\nReturns Nothing in value is not a Float32Array.\n", "type": "Json.Decode.Value -> Maybe.Maybe (JsTypedArray.JsTypedArray JsTypedArray.Float32 Float)" }, { "name": "initialize", "comment": " Initialize an array applying a function to each index.\n\nComplexity: O(length).\n\n JsFloat32Array.initialize 3 (\\n -> n * n)\n --> { 0 = 0, 1 = 1, 2 = 4 } : JsTypedArray Float32 Float\n\n", "type": "Int -> (Int -> Float) -> JsTypedArray.JsTypedArray JsTypedArray.Float32 Float" }, { "name": "repeat", "comment": " Initialize an array of a given length with the same constant.\n\nComplexity: O(length).\n\n JsFloat32Array.repeat 3 42\n --> { 0 = 42, 1 = 42, 2 = 42 } : JsTypedArray Float32 Float\n\n", "type": "Int -> Float -> JsTypedArray.JsTypedArray JsTypedArray.Float32 Float" }, { "name": "unsafeIndexedFromList", "comment": " Initialize from a list of elements (unsafe).\nThe array length is provided as a parameter to\navoid one walk through the list.\nIndex of current element in the list can also be used.\n\nComplexity: O(length).\n\n indexPlusInt index int =\n toFloat (index + int)\n\n intList =\n [ 0, 14, 42 ]\n\n JsFloat32Array.unsafeIndexedFromList 3 indexPlusInt intList\n --> { 0 = 0, 1 = 15, 2 = 44 }\n\n", "type": "Int -> (Int -> a -> Float) -> List a -> JsTypedArray.JsTypedArray JsTypedArray.Float32 Float" }, { "name": "zeros", "comment": " Initialize an array of zeros of a given length.\nInternally uses `new Float32Array( length )`.\n\nComplexity: O(length).\n\n JsFloat32Array.zeros 3\n --> { 0 = 0, 1 = 0, 2 = 0 } : JsTypedArray Float32 Float\n\n", "type": "Int -> JsTypedArray.JsTypedArray JsTypedArray.Float32 Float" } ], "generated-with-elm-version": "0.18.0" }, { "name": "MutableJsDataView", "comment": " Provides functions on [DataView] modifying the underlying buffer.\n\n[DataView]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView\n\n@docs MutableJsDataView\n\n@docs setInt8, setUint8, setInt16, setUint16, setInt32, setUint32\n\n@docs setFloat32, setFloat64\n\n", "aliases": [ { "name": "MutableJsDataView", "comment": " Alias for a `JsDataView`. Reminder of the mutability aspect of functions.\n", "args": [], "type": "JsDataView.JsDataView" } ], "types": [], "values": [ { "name": "setFloat32", "comment": " Write a Float32 at the given offset (added to DataView own offset).\n", "type": "Int -> Float -> MutableJsDataView.MutableJsDataView -> MutableJsDataView.MutableJsDataView" }, { "name": "setFloat64", "comment": " Write a Float64 at the given offset (added to DataView own offset).\n", "type": "Int -> Float -> MutableJsDataView.MutableJsDataView -> MutableJsDataView.MutableJsDataView" }, { "name": "setInt16", "comment": " Write an Int16 at the given offset (added to DataView own offset).\n", "type": "Int -> Int -> MutableJsDataView.MutableJsDataView -> MutableJsDataView.MutableJsDataView" }, { "name": "setInt32", "comment": " Write an Int32 at the given offset (added to DataView own offset).\n", "type": "Int -> Int -> MutableJsDataView.MutableJsDataView -> MutableJsDataView.MutableJsDataView" }, { "name": "setInt8", "comment": " Write an Int8 at the given offset (added to JsDataView own offset).\n", "type": "Int -> Int -> MutableJsDataView.MutableJsDataView -> MutableJsDataView.MutableJsDataView" }, { "name": "setUint16", "comment": " Write an Uint16 at the given offset (added to DataView own offset).\n", "type": "Int -> Int -> MutableJsDataView.MutableJsDataView -> MutableJsDataView.MutableJsDataView" }, { "name": "setUint32", "comment": " Write an Uint32 at the given offset (added to DataView own offset).\n", "type": "Int -> Int -> MutableJsDataView.MutableJsDataView -> MutableJsDataView.MutableJsDataView" }, { "name": "setUint8", "comment": " Write an Uint8 at the given offset (added to JsDataView own offset).\n", "type": "Int -> Int -> MutableJsDataView.MutableJsDataView -> MutableJsDataView.MutableJsDataView" } ], "generated-with-elm-version": "0.18.0" }, { "name": "JsTypedArray", "comment": " This module wraps JavaScript typed arrays in elm.\n\n@docs JsTypedArray\n\nThe list of all JavaScript typed arrays representable is as below:\n\n@docs Uint8, Float64, Float32\n\n\n# Typed Array Creation\n\nFunctions to initialize typed arrays are in their dedicated modules.\nSee for example the function `JsUint8Array.zeros : Int -> JsTypedArray Uint8 Int`\nin the `JsUint8Array` module.\n\n\n# Interoperability\n\nThere are `fromList` and `fromArray` functions available in dedicated modules.\nFor example, in module `JsUint8Array`:\n\n JsUint8Array.fromList : List Int -> JsTypedArray Uint8 Int\n\n JsUint8Array.fromArray : Array Int -> JsTypedArray Uint8 Int\n\nIn this module are provided the `toList` and `toArray` polymorphic functions.\n\n@docs toList, toArray\n\nEncoders and decoders are providing 0-cost data exchange through ports.\nThe typed arrays are not \"converted\" since they already are JavaScript values.\nA `decode` function is available in each dedicated modules,\nand the polymorphic `encode` function is in this module.\n\n@docs encode\n\n\n# Basic Requests\n\n@docs length, getAt, unsafeGetAt, buffer, bufferOffset\n\n\n# Predicates\n\nPredicates here are functions returning a boolean.\nThey come in two flavors. The `indexed...` version is additionally using\nthe index as the first argument of the function to evaluate.\nThe following functions use predicates to analyze typed arrays.\n\n@docs all, any, findIndex, filter\n\n@docs indexedAll, indexedAny, indexedFindIndex, indexedFilter\n\n\n# Comparison\n\n@docs equal\n\n\n# Array Extraction and Appending\n\n@docs extract, append\n\n\n# Array Transformations\n\nTransform a typed array into another of the same type.\nAll such transformations imply a full copy of the array\nto avoid side effects.\nComplexity is thus greater than O(length).\n\n@docs replaceWithConstant, map, map2, reverse, sort, reverseSort\n\n@docs indexedMap, indexedMap2\n\n\n# Array Reductions\n\nReduce an array to a single value.\n\n@docs join, foldl, foldr, foldl2, foldr2, foldlr\n\nIndexed versions of reducers.\n\n@docs indexedFoldl, indexedFoldr, indexedFoldl2, indexedFoldr2\n\n", "aliases": [], "types": [ { "name": "Float32", "comment": " 32-bits floating point number.\n", "args": [], "cases": [] }, { "name": "Float64", "comment": " 64-bits floating point number.\n", "args": [], "cases": [] }, { "name": "JsTypedArray", "comment": " `JsTypedArray a b` represents a [JavaScript typed array][typed-array].\n\n[typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays\n\nThe first type parameter `a` is used to indicate the type of data stored inside\nthe array. Depending on how you initialize the array,\nit may be `Uint8`, `Int32`, `Float64` etc.\nThe second type parameter `b` is used to indicate which elm type is compatible\nwith the data type in the array. Most probably, it will be `Int` or `Float`.\n\nThose type parameters (`a` and `b`) are fixed at the creation of the array.\nFor example, a function generating a JavaScript `Uint8Array` will have the return type:\n`JsTypedArray Uint8 Int`.\n\n", "args": [ "a", "b" ], "cases": [] }, { "name": "Uint8", "comment": " 8-bits unsigned integer.\n", "args": [], "cases": [] } ], "values": [ { "name": "all", "comment": " Return `True` if all elements satisfy the predicate.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.all (\\x -> x < 50)\n --> True\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.all (\\x -> x < 20)\n --> False\n\n", "type": "(b -> Bool) -> JsTypedArray.JsTypedArray a b -> Bool" }, { "name": "any", "comment": " Return `True` if at least one element satisfies the predicate.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.any (\\x -> x > 50)\n --> False\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.any (\\x -> x > 20)\n --> True\n\n", "type": "(b -> Bool) -> JsTypedArray.JsTypedArray a b -> Bool" }, { "name": "append", "comment": " Append two arrays of the same type into a new one.\n\nComplexity: O(n).\n\n typedArray1 =\n JsUint8Array.fromList [ 0, 1 ]\n\n typedArray2 =\n JsUint8Array.fromList [ 0, 14, 42 ]\n\n JsTypedArray.append typedArray1 typedArray2\n --> { 0 = 0, 1 = 1, 2 = 0, 3 = 14, 4 = 42 }\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "buffer", "comment": " Get the underlying data buffer of the array.\n\nComplexity: O(1).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.buffer\n |> JsArrayBuffer.length\n --> 3\n\n JsFloat64Array.fromList [0, 14, 42]\n |> JsTypedArray.buffer\n |> JsArrayBuffer.length\n --> 24\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsArrayBuffer.JsArrayBuffer" }, { "name": "bufferOffset", "comment": " Get the offset (in bytes) from the start of its corresponding buffer.\n\nComplexity: O(1).\n\n JsArrayBuffer.zeros 5\n |> JsUint8Array.fromBuffer 3 2\n |> Result.map JsTypedArray.bufferOffset\n --> Ok 3\n\n", "type": "JsTypedArray.JsTypedArray a b -> Int" }, { "name": "encode", "comment": " Encode a `JsTypedArray` into a JavaScript `Value`\nthat can be sent through ports.\n\nComplexity: O(1).\n\n", "type": "JsTypedArray.JsTypedArray a b -> Json.Encode.Value" }, { "name": "equal", "comment": " Check if two typed arrays of the same type are equal.\n\n_WARNING: using the `(==)` operator yields wrong results._\n\nFor example:\n\n JsUint8Array.fromList [] == JsUint8Array.fromList [42]\n --> True\n\nFor this reason, we need to introduce a specific function\nto check if two typed arrays are equal.\n\n typedArray1 =\n JsUint8Array.fromList [0, 14, 42]\n\n typedArray2 =\n JsUint8Array.fromList [0, 14, 42, 1000]\n\n typedArray3 =\n JsTypedArray.extract 0 3 typedArray2\n\n JsTypedArray.equal typedArray1 typedArray2\n --> False\n\n JsTypedArray.equal typedArray1 typedArray3\n --> True\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> Bool" }, { "name": "extract", "comment": " Extract a segment of the array between given start (included)\nand end (excluded) indices.\nIt reuses the same buffer, changing offset and length attributes.\nThus this is extremely fast since it doesn't copy the data buffer.\n\nIn case of negative indices, count backward from end of array.\n\nComplexity: O(1).\n\n f64Array =\n JsFloat64Array.fromList [0, 14, 42]\n |> JsTypedArray.extract 1 3\n --> { 0 = 14, 1 = 42 }\n\n JsTypedArray.bufferOffset f64Array\n --> 8\n\n JsFloat64Array.fromList [0, 14, 42]\n |> JsTypedArray.extract -2 -1\n --> { 0 = 14 }\n\n JsFloat64Array.fromList [0, 14, 42]\n |> JsTypedArray.extract -2 100000\n --> { 0 = 14, 1 = 42 }\n\n", "type": "Int -> Int -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "filter", "comment": " Filter an array, keeping only elements satisfying the predicate.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.filter (\\x -> x > 20)\n --> { 0 = 42 }\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.filter (\\x -> x < 20)\n --> { 0 = 0, 1 = 14 }\n\n", "type": "(b -> Bool) -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "findIndex", "comment": " Return the index of the first element satisfying the predicate.\nIf no element satisfies it, returns `Nothing`.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.findIndex (\\x -> x > 20)\n --> Just 2\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.findIndex (\\x -> x > 50)\n --> Nothing\n\n", "type": "(b -> Bool) -> JsTypedArray.JsTypedArray a b -> Maybe.Maybe Int" }, { "name": "foldl", "comment": " Reduce the array from the left.\n\nComplexity: O(length).\n\n sumArray : JsTypedArray a number -> number\n sumArray =\n JsTypedArray.foldl (+) 0\n\n JsUint8Array.fromList [0, 14, 42]\n |> sumArray\n --> 56\n\n", "type": "(b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "foldl2", "comment": " Reduce two arrays from the left.\nThe longer array is troncated at the size of the smaller one.\n\nComplexity: O(length).\n\n innerProduct : JsTypedArray a number -> JsTypedArray a number -> number\n innerProduct =\n JsTypedArray.foldl2 (\\x y product -> x * y + product) 0\n\n typedArray1 =\n JsUint8Array.fromList [0, 1, 2]\n\n typedArray2 =\n JsUint8Array.fromList [0, 14, 42, 10000]\n\n innerProduct typedArray1 typedArray2\n --> 98\n\n", "type": "(b -> b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "foldlr", "comment": " Reduce two arrays, first from left, second from right.\nThe longer array is troncated at the size of the smaller one.\n\nComplexity: O(length).\n\n zipInward : JsTypedArray a b -> JsTypedArray a b -> List (b,b)\n zipInward =\n JsTypedArray.foldlr (\\x y list -> (x,y) :: list) []\n\n typedArray1 =\n JsUint8Array.fromList [0, 1, 2]\n\n typedArray2 =\n JsUint8Array.fromList [0, 1, 2, 3]\n\n zipInward typedArray1 typedArray2\n --> [ (2,1), (1,2), (0,3) ]\n\n", "type": "(b -> b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "foldr", "comment": " Reduce the array from the right.\n\nComplexity: O(length).\n\n arrayToList : JsTypedArray a b -> List b\n arrayToList =\n JsTypedArray.foldr (::) []\n\n JsUint8Array.fromList [0, 14, 42]\n |> arrayToList\n --> [0, 14, 42]\n\n", "type": "(b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "foldr2", "comment": " Reduce two arrays from the right.\nThe longer array is troncated at the size of the smaller one.\n\nComplexity: O(length).\n\n toZipList : JsTypedArray a b -> JsTypedArray a b -> List (b,b)\n toZipList =\n JsTypedArray.foldr2 (\\x y list -> (x,y) :: list) []\n\n typedArray1 =\n JsUint8Array.fromList [0, 1, 2]\n\n typedArray2 =\n JsUint8Array.fromList [0, 14, 42, 10000]\n\n toZipList typedArray1 typedArray2\n --> [ (0,14), (1,42), (2,1000) ]\n\n", "type": "(b -> b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "getAt", "comment": " Get the value at given index.\nReturn `Nothing` if index is outside of bounds.\n\nComplexity: O(1).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.getAt 2\n --> Just 42\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.getAt 3\n --> Nothing\n\n", "type": "Int -> JsTypedArray.JsTypedArray a b -> Maybe.Maybe b" }, { "name": "indexedAll", "comment": " Indexed version of `all`.\n\nComplexity: O(length).\n\n", "type": "(Int -> b -> Bool) -> JsTypedArray.JsTypedArray a b -> Bool" }, { "name": "indexedAny", "comment": " Indexed version of `any`.\n\nComplexity: O(length).\n\n", "type": "(Int -> b -> Bool) -> JsTypedArray.JsTypedArray a b -> Bool" }, { "name": "indexedFilter", "comment": " Indexed version of `filter`.\n\nComplexity: O(length).\n\n", "type": "(Int -> b -> Bool) -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "indexedFindIndex", "comment": " Indexed version of `findIndex`.\n\nComplexity: O(length).\n\n", "type": "(Int -> b -> Bool) -> JsTypedArray.JsTypedArray a b -> Maybe.Maybe Int" }, { "name": "indexedFoldl", "comment": " Indexed version of foldl.\n", "type": "(Int -> b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "indexedFoldl2", "comment": " Indexed version of foldl2.\n", "type": "(Int -> b -> b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "indexedFoldr", "comment": " Indexed version of foldr.\n", "type": "(Int -> b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "indexedFoldr2", "comment": " Indexed version of foldr2.\n", "type": "(Int -> b -> b -> c -> c) -> c -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> c" }, { "name": "indexedMap", "comment": " Indexed version of `map`.\n", "type": "(Int -> b -> b) -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "indexedMap2", "comment": " Indexed version of `map2`.\n", "type": "(Int -> b -> b -> b) -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "join", "comment": " Join array values in a string using the given separator.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.join \",\"\n --> \"0,14,42\"\n\n", "type": "String -> JsTypedArray.JsTypedArray a b -> String" }, { "name": "length", "comment": " Get the number of elements in the array.\nBeware that this length (in number of elements)\nis different from its buffer length (in bytes).\n\nComplexity: O(1).\n\n JsUint8Array.zeros 5\n |> JsTypedArray.length\n --> 5\n\n", "type": "JsTypedArray.JsTypedArray a b -> Int" }, { "name": "map", "comment": " Apply a function to every element of the array.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.map (\\x -> x + 1)\n --> { 0 = 1, 1 = 15, 2 = 43 }\n\n", "type": "(b -> b) -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "map2", "comment": " Apply a function to every element of two arrays to form a new one.\nThe bigger array is troncated at the size of the smaller one.\n\nComplexity: O(length).\n\n typedArray1 =\n JsUint8Array.fromList [ 0, 1, 2 ]\n\n typedArray2 =\n JsUint8Array.fromList [ 0, 14, 42 ]\n\n typedArray3 =\n JsUint8Array.fromList [ 0, 1, 2, 3, 4, 5, 6, 7 ]\n\n JsTypedArray.map2 (+) typedArray1 typedArray2\n --> { 0 = 0, 1 = 15, 2 = 44 }\n\n JsTypedArray.map2 (+) typedArray1 typedArray3\n --> { 0 = 0, 1 = 2, 2 = 4 }\n\n", "type": "(b -> b -> b) -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "replaceWithConstant", "comment": " Replace a segment [start, end[ of the array by a constant value.\n\nNegative indices are counted backward from end of array.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [0, 14, 42]\n |> JsTypedArray.replaceWithConstant 1 3 17\n --> { 0 = 0, 1 = 17, 2 = 17 }\n\n", "type": "Int -> Int -> b -> JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "reverse", "comment": " Reverse the array.\n\nComplexity: O(length).\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "reverseSort", "comment": " Sort the array in reverse order.\n\nComplexity: depends on browser implementation.\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "sort", "comment": " Sort the array.\n\nComplexity: depends on browser implementation.\n\n", "type": "JsTypedArray.JsTypedArray a b -> JsTypedArray.JsTypedArray a b" }, { "name": "toArray", "comment": " Convert a typed array to an array.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [ 0, 14, 42 ]\n |> JsTypedArray.toArray\n --> Array.fromList [0,14,42]\n\n", "type": "JsTypedArray.JsTypedArray a b -> Array.Array b" }, { "name": "toList", "comment": " Convert a typed array to a list.\n\nComplexity: O(length).\n\n JsUint8Array.fromList [ 0, 14, 42 ]\n |> JsTypedArray.toList\n --> [ 0, 14, 42 ]\n\n", "type": "JsTypedArray.JsTypedArray a b -> List b" }, { "name": "unsafeGetAt", "comment": " Same as `getAt` but unsafe.\nOnly useful if performance is required.\n\n_WARNING: will throw if index is outside of bounds._\n\nComplexity: O(1).\n\n", "type": "Int -> JsTypedArray.JsTypedArray a b -> b" } ], "generated-with-elm-version": "0.18.0" }, { "name": "JsDataView", "comment": " Provides a low-level interface for reading and writing\nmultiple number types in an ArrayBuffer, with control over endianness.\n\n[DataView]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView\n\n@docs JsDataView, empty, fromBuffer, buffer, byteLength, byteOffset\n\n@docs getInt8, getUint8, getInt16, getUint16, getInt32, getUint32\n\n@docs getFloat32, getFloat64\n\n", "aliases": [], "types": [ { "name": "JsDataView", "comment": " Corresponds to JavaScript [DataView].\n", "args": [], "cases": [] } ], "values": [ { "name": "buffer", "comment": " Return the underlying buffer.\n", "type": "JsDataView.JsDataView -> JsArrayBuffer.JsArrayBuffer" }, { "name": "byteLength", "comment": " Length in bytes of the JsDataView.\n", "type": "JsDataView.JsDataView -> Int" }, { "name": "byteOffset", "comment": " Offset in bytes of the JsDataView with regard to\nthe beginning of the underlying array buffer.\n", "type": "JsDataView.JsDataView -> Int" }, { "name": "empty", "comment": " Create an empty JsDataView\n", "type": "JsDataView.JsDataView" }, { "name": "fromBuffer", "comment": " Initialize a JsDataView on an array buffer, at a given offset, of a given length.\n", "type": "Int -> Int -> JsArrayBuffer.JsArrayBuffer -> Result.Result JsArrayBuffer.RangeError JsDataView.JsDataView" }, { "name": "getFloat32", "comment": " Read a Float32 at the given offset (added to JsDataView own offset).\n", "type": "Int -> JsDataView.JsDataView -> Result.Result JsArrayBuffer.RangeError Float" }, { "name": "getFloat64", "comment": " Read a Float64 at the given offset (added to JsDataView own offset).\n", "type": "Int -> JsDataView.JsDataView -> Result.Result JsArrayBuffer.RangeError Float" }, { "name": "getInt16", "comment": " Read an Int16 at the given offset (added to JsDataView own offset).\n", "type": "Int -> JsDataView.JsDataView -> Result.Result JsArrayBuffer.RangeError Int" }, { "name": "getInt32", "comment": " Read an Int32 at the given offset (added to JsDataView own offset).\n", "type": "Int -> JsDataView.JsDataView -> Result.Result JsArrayBuffer.RangeError Int" }, { "name": "getInt8", "comment": " Read an Int8 at the given offset (added to JsDataView own offset).\n", "type": "Int -> JsDataView.JsDataView -> Result.Result JsArrayBuffer.RangeError Int" }, { "name": "getUint16", "comment": " Read an Uint16 at the given offset (added to JsDataView own offset).\n", "type": "Int -> JsDataView.JsDataView -> Result.Result JsArrayBuffer.RangeError Int" }, { "name": "getUint32", "comment": " Read an Uint32 at the given offset (added to JsDataView own offset).\n", "type": "Int -> JsDataView.JsDataView -> Result.Result JsArrayBuffer.RangeError Int" }, { "name": "getUint8", "comment": " Read an Uint8 at the given offset (added to JsDataView own offset).\n", "type": "Int -> JsDataView.JsDataView -> Result.Result JsArrayBuffer.RangeError Int" } ], "generated-with-elm-version": "0.18.0" }, { "name": "JsArrayBuffer", "comment": " This module is wrapping javascript [ArrayBuffer].\n\nArray buffers are basic bytes arrays that have to be manipulated\nthrough views (like Uint8Array, Float64Array, etc.).\n[ArrayBuffer] documentation is available on MDN web docs.\n\n[ArrayBuffer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer\n\n@docs JsArrayBuffer, RangeError, zeros, length, slice, fromValue, encode, decode, equal\n\n", "aliases": [], "types": [ { "name": "JsArrayBuffer", "comment": " Representation of a javascript array buffer.\n", "args": [], "cases": [] }, { "name": "RangeError", "comment": " Errors that may occur while manipulating an array buffer.\n", "args": [], "cases": [ [ "NegativeOffset", [ "Int" ] ], [ "NegativeLength", [ "Int" ] ], [ "OffsetNotMultipleElementSize", [ "{ offset : Int, elementSize : Int }" ] ], [ "BufferOverflow", [ "{ bufferLength : Int, offset : Int, byteLength : Int }" ] ] ] } ], "values": [ { "name": "decode", "comment": " `JsArrayBuffer` decoder.\n", "type": "Json.Decode.Decoder JsArrayBuffer.JsArrayBuffer" }, { "name": "encode", "comment": " Encode a `JsArrayBuffer` into a JavaScript `Value`\nthat can be sent through ports.\n\nComplexity: O(1).\n\n", "type": "JsArrayBuffer.JsArrayBuffer -> Json.Encode.Value" }, { "name": "equal", "comment": " Check if two array buffers are equal.\n\n_WARNING: using the `(==)` operator yields wrong results._\n\nFor example:\n\n JsArrayBuffer.zeros 0 == JsArrayBuffer.zeros 1\n --> True\n\n", "type": "JsArrayBuffer.JsArrayBuffer -> JsArrayBuffer.JsArrayBuffer -> Bool" }, { "name": "fromValue", "comment": " Transform a compatible JavaScript value into an array buffer.\nReturns Nothing in value is not an array buffer.\n", "type": "Json.Decode.Value -> Maybe.Maybe JsArrayBuffer.JsArrayBuffer" }, { "name": "length", "comment": " Return the length of the array buffer.\n", "type": "JsArrayBuffer.JsArrayBuffer -> Int" }, { "name": "slice", "comment": " Get a sub section of an array: `(slice start end array)`.\nThe `start` is a zero-based index where we will start our slice.\nThe `end` is a zero-based index that indicates the end of the slice.\nThe slice extracts up to, but no including, the `end`.\n\nBoth `start` and `end` can be negative, indicating an offset from the end\nof the array. Popping the last element of the array is therefore:\n`slice 0 -1 array`.\n\nIn the case of an impossible slice, the empty array is returned.\n\n", "type": "Int -> Int -> JsArrayBuffer.JsArrayBuffer -> JsArrayBuffer.JsArrayBuffer" }, { "name": "zeros", "comment": " Initialize an array buffer of a given length.\n\nIf `length` is negative, creates an empty array.\n\n", "type": "Int -> JsArrayBuffer.JsArrayBuffer" } ], "generated-with-elm-version": "0.18.0" } ]