Module

Data.Array.Partial

Package
purescript-arrays
Repository
purescript/purescript-arrays

Partial helper functions for working with immutable arrays.

#head Source

head :: forall a. Partial => Array a -> a

Get the first element of a non-empty array.

Running time: O(1).

#tail Source

tail :: forall a. Partial => Array a -> Array a

Get all but the first element of a non-empty array.

Running time: O(n), where n is the length of the array.

#last Source

last :: forall a. Partial => Array a -> a

Get the last element of a non-empty array.

Running time: O(1).

#init Source

init :: forall a. Partial => Array a -> Array a

Get all but the last element of a non-empty array.

Running time: O(n), where n is the length of the array.