[
    {
        "name": "Array.NonEmpty",
        "comment": " An array that always contains at least one element.\n\nAdditionaly, it can track a currently selected index, which is guaranteed to\npoint to an existing element in the array.\n\nMost functions (like `map`) keep the currently selected index untouched, other functions (like `filter` or `slice`) discard the currently selected and reset it to zero. If not otherwise mentioned, the selected index is kept; if it is discard, the function documentation states so explicitly.\n\n\n# Non Empty Array\n\n@docs NonEmptyArray\n\n\n# Creation\n\n@docs fromElement, initialize, repeat, fromList, fromArray\n\n\n# Query\n\n@docs length, get, getFirst\n\n\n# Manipulate\n\n@docs set, update, push, append, slice\n\n\n# Selected Index\n\n@docs selectedIndex, setSelectedIndex, setSelectedIndexAndReport, getSelected, updateSelected\n\n\n# Conversions\n\n@docs toArray, toList, toIndexedList\n\n\n# Transform\n\n@docs foldl, foldr, filter, map, indexedMap\n\n\n# Display\n\n@docs toString\n\n",
        "unions": [
            {
                "name": "NonEmptyArray",
                "comment": " An array that is known, at compile-time, to be non empty. It always has at\nleast one element.\n",
                "args": [
                    "a"
                ],
                "cases": []
            }
        ],
        "aliases": [],
        "values": [
            {
                "name": "append",
                "comment": " Append two arrays to a new one.\n\n    Just (append (repeat 2 42) (repeat 3 81)) --> fromList [42, 42, 81, 81, 81]\n\nThe selected index of the resulting array will be the selected index of the\nfirst argument.\n\n",
                "type": "NonEmptyArray a -> NonEmptyArray a -> NonEmptyArray a"
            },
            {
                "name": "filter",
                "comment": " Keep only elements that satisfy the predicate. If no elements remain,\nNothing is returned, otherwise Just the array of remaining elements.\n\n    isEven : Int -> Bool\n    isEven n =\n        n % 2 == 0\n\n    filter isEven (initialize 5 identity) --> fromList [0, 2, 4]\n\nThe selected index will be set to 0 for the resulting array.\n\n",
                "type": "(a -> Bool) -> NonEmptyArray a -> Maybe (NonEmptyArray a)"
            },
            {
                "name": "foldl",
                "comment": " Reduce an array from the left. Read `foldl` as fold from the left.\n\n    foldl (::) [] (initialize 3 identity) --> [2, 1, 0]\n\n",
                "type": "(a -> b -> b) -> b -> NonEmptyArray a -> b"
            },
            {
                "name": "foldr",
                "comment": " Reduce an array from the right. Read `foldr` as fold from the right.\n\n    foldr (+) 0 (repeat 3 5) --> 15\n\n",
                "type": "(a -> b -> b) -> b -> NonEmptyArray a -> b"
            },
            {
                "name": "fromArray",
                "comment": " Create a `NonEmptyArray` from an `Array`.\n\nGiven an empty array, this function will return `Nothing`.\nGiven an array with at least one element, this function will return `Just` that\narray, converted to a `NonEmptyArray`.\n\nThe selected index of the resulting array will be 0.\n\n",
                "type": "Array a -> Maybe (NonEmptyArray a)"
            },
            {
                "name": "fromElement",
                "comment": " Creates a new, non empty array with a single element. The selected index of\nthe resulting array will be 0.\n",
                "type": "a -> NonEmptyArray a"
            },
            {
                "name": "fromList",
                "comment": " Create a `NonEmptyArray` from a `List`.\n\nGiven an empty list, this function will return `Nothing`.\nGiven a list with at least one element, this function will return `Just` that\nlist, converted to a `NonEmptyArray`.\n\nThe selected index of the resulting array will be 0.\n\n",
                "type": "List a -> Maybe (NonEmptyArray a)"
            },
            {
                "name": "get",
                "comment": " Return `Just` the element at the index or `Nothing` if the index is out of\nrange.\n\n    get  0 (initialize 3 identity) --> Just 0\n\n    get  2 (initialize 3 identity) --> Just 2\n\n    get  5 (initialize 3 identity) --> Nothing\n\n    get -1 (initialize 3 identity) -->  Nothing\n\nNotice that in contrast to mgold/elm-nonempty-list, where `head` and `tail` do\nnot return Maybes, this function still necessarily returns a Maybe, because the\ngiven index can still be out of range. But see `getFirst` for a function that is\nknown at compile time to return a value.\n\n",
                "type": "Int -> NonEmptyArray a -> Maybe a"
            },
            {
                "name": "getFirst",
                "comment": " Return the first element of a NonEmptyArray.\n\n    getFirst (initialize 3 identity) --> 0\n\n",
                "type": "NonEmptyArray a -> a"
            },
            {
                "name": "getSelected",
                "comment": " Return the element at the selected index.\n\n    initialize 3 identity\n        |> setSelectedIndex 1\n        |> getSelected\n    --> 1\n\n",
                "type": "NonEmptyArray a -> a"
            },
            {
                "name": "indexedMap",
                "comment": " Apply a function to every element with its index as first argument.\n\n    Just (indexedMap (*) (repeat 5 2)) --> fromList [0, 2, 4, 6, 8]\n\n",
                "type": "(Int -> a -> b) -> NonEmptyArray a -> NonEmptyArray b"
            },
            {
                "name": "initialize",
                "comment": " Initialize an array. `initialize n f` creates an array of length `n` with\nthe element at index `i` initialized to the result of `(f i)`.\n\nWhen the requested number of elements is smaller than one (0 or negative), the\nreturned array will still contain one element, `f 0`.\n\n    Just (initialize 4 identity)    --> fromList [0, 1, 2, 3]\n\n    Just (initialize 4 (\\n -> n*n)) --> fromList [0, 1, 4, 9]\n\n    Just (initialize 4 (always 0))  --> fromList [0, 0, 0, 0]\n\n    Just (initialize 0 identity)  --> fromList [0]\n\nThe selected index of the resulting array will be 0.\n\n",
                "type": "Int -> (Int -> a) -> NonEmptyArray a"
            },
            {
                "name": "length",
                "comment": " Return the length of the array.\n",
                "type": "NonEmptyArray a -> Int"
            },
            {
                "name": "map",
                "comment": " Apply a function to every element in an array.\n\n    map Basics.toString (repeat 5 1) --> repeat 5 \"1\"\n\n",
                "type": "(a -> b) -> NonEmptyArray a -> NonEmptyArray b"
            },
            {
                "name": "push",
                "comment": " Push an element onto the end of an array.\n\n    Just (push 2 (fromElement 1)) --> fromList [1, 2]\n\n",
                "type": "a -> NonEmptyArray a -> NonEmptyArray a"
            },
            {
                "name": "repeat",
                "comment": " Creates an array with a given length, filled with a default element.\n\nWhen the requested number of elements is smaller than one (0 or negative),\nthis function will still return a non empty array with one element.\n\n    Just (repeat 5 0)     --> fromList [0, 0, 0, 0, 0]\n\n    Just (repeat 3 \"cat\") --> fromList [\"cat\", \"cat\", \"cat\"]\n\n    Just (repeat 0 \"frog\") --> fromList [\"frog\"]\n\nNotice that `repeat 3 x` is the same as `initialize 3 (always x)`.\n\nThe selected index of the resulting array will be 0.\n\n",
                "type": "Int -> a -> NonEmptyArray a"
            },
            {
                "name": "selectedIndex",
                "comment": " Return the selected index.\n\n    repeat 5 \"x\"\n        |> setSelectedIndex 3\n        |> selectedIndex\n    --> 3\n\n",
                "type": "NonEmptyArray a -> Int"
            },
            {
                "name": "set",
                "comment": " Set the element at a particular index. Returns an updated array.\nIf the index is out of range, the array is unaltered.\n\n    set 0 1302 (fromElement 42) --> fromElement 1302\n\n",
                "type": "Int -> a -> NonEmptyArray a -> NonEmptyArray a"
            },
            {
                "name": "setSelectedIndex",
                "comment": " Set the selected index for the given array.\nIf the index is out of range, the array is unaltered (that is, the old selected\nindex is kept).\n\n    initialize 5 identity\n        |> setSelectedIndex 2\n        |> getSelected\n    --> 2\n\n    initialize 5 identity\n        |> setSelectedIndex 7\n        |> getSelected\n    --> 0\n\n",
                "type": "Int -> NonEmptyArray a -> NonEmptyArray a"
            },
            {
                "name": "setSelectedIndexAndReport",
                "comment": " Set the selected index for the given array and reports if an index change\nactually happened. If the index is out of range, the array is unaltered (that\nis, the old selected index is kept).\n\nThe second value of the returned tuple is `True` if and only if the index\nactually changed due to the operation. `False` is returned if you pass in an\nindex that is out of range, or when you pass in the index that is currently\nselected anyway.\n\n    initialize 5 identity\n    |> setSelectedIndexAndReport 2\n    |> Tuple.second\n    --> True\n\n    initialize 5 identity\n    |> setSelectedIndexAndReport 7\n    |> Tuple.second\n    --> False\n\n    initialize 5 identity\n    |> setSelectedIndexAndReport 0\n    |> Tuple.second\n    --> False\n\n",
                "type": "Int -> NonEmptyArray a -> ( NonEmptyArray a, Bool )"
            },
            {
                "name": "slice",
                "comment": " Get a sub-section of an array: `(slice start end array)`. The `start` is a\nzero-based index where we will start our slice. The `end` is a zero-based index\nthat indicates the end of the slice. The slice extracts up to but not including\n`end`. If the resulting slice would be empty, Nothing is returned.\n\n    slice 0 3 (initialize 5 identity) --> fromList [0, 1, 2]\n\n    slice 1 4 (initialize 5 identity) --> fromList [1, 2, 3]\n\n    slice 2 2 (initialize 5 identity) --> Nothing\n\nBoth the `start` and `end` indexes can be negative, indicating an offset from\nthe end of the array.\n\n    slice  1 -1 (initialize 5 identity) --> fromList [1, 2, 3]\n\n    slice -2  5 (initialize 5 identity) --> fromList [3, 4]\n\nThis makes it pretty easy to `pop` the last element off of an array:\n`slice 0 -1 array`\n\nThe selected index will be set to 0 for the resulting array.\n\n",
                "type": "Int -> Int -> NonEmptyArray a -> Maybe (NonEmptyArray a)"
            },
            {
                "name": "toArray",
                "comment": " Converts the NonEmptyArray into a standard array.\n\n    import Array.Hamt as Array\n\n    fromArray (Array.fromList [1, 2])\n        |> Maybe.map toArray\n    --> Just (Array.fromList [1, 2])\n\n",
                "type": "NonEmptyArray a -> Array a"
            },
            {
                "name": "toIndexedList",
                "comment": " Create an indexed list from an array. Each element of the array will be\npaired with its index.\n\n    fromList [\"cat\", \"dog\"]\n        |> Maybe.map toIndexedList\n    --> Just [(0, \"cat\"), (1, \"dog\")]\n\n",
                "type": "NonEmptyArray a -> List ( Int, a )"
            },
            {
                "name": "toList",
                "comment": " Create a list of elements from an array.\n\n    fromList [3, 5, 8]\n        |> Maybe.map toList\n    --> Just [3, 5, 8]\n\n",
                "type": "NonEmptyArray a -> List a"
            },
            {
                "name": "toString",
                "comment": " Return a representation of the NonEmptyArray as a string. The number in\nparantheses after the list of elements is the selected index.\n\n    import Array.NonEmpty as NEA\n\n    NEA.toString <| (initialize 3 identity) --> \"NonEmptyArray [0,1,2] (0)\"\n\n",
                "type": "NonEmptyArray a -> String"
            },
            {
                "name": "update",
                "comment": " Update the element at the given index using a function. Returns the array\nunchanged if the index is out of bounds.\n\n    Just <| update 1 ((+) 10) (initialize 3 identity)\n    --> fromList [0, 11, 2]\n\n    Just <| update 4 ((+) 10) (initialize 3 identity)\n    --> fromList [0, 1, 2]\n\n    Just <| update -1 ((+) 10) (initialize 3 identity)\n    --> fromList [0, 1, 2]\n\nThis is basically Array.Extra.update from elm-community/array-extra, for\nNonEmptyArray.\n\n",
                "type": "Int -> (a -> a) -> NonEmptyArray a -> NonEmptyArray a"
            },
            {
                "name": "updateSelected",
                "comment": " Update the element at the current selected index using a function.\n\n    Just <| updateSelected ((+) 10) (initialize 3 identity)\n    --> fromList [10, 1, 2]\n\n",
                "type": "(a -> a) -> NonEmptyArray a -> NonEmptyArray a"
            }
        ],
        "binops": []
    }
]