Module
Data.Array.Extra.Unsafe
- Package
- purescript-arrays-extra
- Repository
- flip111/purescript-arrays-extra
Unsafe but faster functions due to no out of bounds checking.
#unsafeDeleteAt Source
unsafeDeleteAt :: forall a. Partial => Int -> Array a -> Array a
Delete the element at index i
in an array
unsafePartial $ unsafeDeleteAt 1 ["a", "b", "c"] = ["a", "c"]
#unsafeInsertAt Source
unsafeInsertAt :: forall a. Partial => Int -> a -> Array a -> Array a
Insert the element at index i
in an array
unsafePartial $ unsafeInsertAt 1 "b" ["a", "c"] = ["a", "b", "c"]
#unsafeUpdateAt Source
unsafeUpdateAt :: forall a. Partial => Int -> a -> Array a -> Array a
Overwrite the element at index i
in an array
unsafePartial $ unsafeUpdateAt 1 "e" ["a", "b", "c"] = ["a", "e", "c"]
#unsafeModifyAt Source
unsafeModifyAt :: forall a. Partial => Int -> (a -> a) -> Array a -> Array a
Overwrite the element at index i
in an array
unsafePartial $ unsafeModifyAt 1 (\a -> a <> "e") ["a", "b", "c"] = ["a", "be", "c"]
#unsafeHead Source
unsafeHead :: forall a. Array a -> a
Get the first element in an array. Passing Nothing
to unsafeHead
will throw an error at
runtime.