A data type with O(1) take/drop using an array as the underlying storage.
newtype Slice aRepresents a slice of an array.
slice :: forall a. [a] -> Slice aCreate a slice from an array.
sarray :: forall a. Slice a -> [a]Construct a new array from a slice.
sempty :: forall a. Slice aConstructor for the empty slice.
sat :: forall a. Slice a -> Number -> Maybe aAccess an element at an index.
seq :: forall a. (Eq a) => Slice a -> Slice a -> BooleanEquality test.
sdrop :: forall a. Number -> Slice a -> Slice aDrop a number of elements from the start of a slice, creating a new slice (O(1)).
stake :: forall a. Number -> Slice a -> Slice aKeep only a number of elements from the start of a slice, creating a new slice (O(1)).
shead :: forall a. Slice a -> Maybe aGet the first element in a slice, or Nothing if the slice is empty.
slast :: forall a. Slice a -> Maybe aGet the last element in a slice, or Nothing if the slice is empty.
sinit :: forall a. Slice a -> Maybe (Slice a)Get all but the last element of a slice, creating a new slice,
or Nothing if the slice is empty (O(1)).
stail :: forall a. Slice a -> Maybe (Slice a)Get all but the first element of a slice, creating a new slice,
or Nothing if the slice is empty (O(1)).
snull :: forall a. Slice a -> BooleanTest whether a slice is empty.
sappend :: forall a. Slice a -> Slice a -> Slice aConcatenate two slices, creating a new slice.
sconcat :: forall a. Slice (Slice a) -> Slice aFlatten a slice of slices, creating a new slice
sconcatMap :: forall a b. (a -> Slice b) -> Slice a -> Slice bApply a function to each element in an array, and flatten the results into a single, new array.
sfind :: forall a. (a -> Boolean) -> Slice a -> NumberFind the first index for which a predicate holds,
or -1 if no such element exists.
sfindLast :: forall a. (a -> Boolean) -> Slice a -> NumberFind the last index for which a predicate holds,
or -1 if no such element exists.
smap :: forall a b. (a -> b) -> Slice a -> Slice bApply a function to each element in a slice, creating a new slice.
sfoldl :: forall a b. (b -> a -> b) -> b -> Slice a -> bApply a left-folding function to a slice.
sfoldr :: forall a b. (a -> b -> b) -> b -> Slice a -> bApply a right-folding function to a slice.
szipWith :: forall a b c. (a -> b -> c) -> Slice a -> Slice b -> Slice cApply a function to pairs of elements at the same index in two slices, collecting the results in a new slice.
If one slice is longer, elements will be discarded from the longer slice.
For example
szipWith (*) (slice [1, 2, 3]) (slice [4, 5, 6, 7]) == slice [4, 10, 18]instance showSlice :: (Show a) => Show (Slice a)instance semigroupSlice :: Semigroup (Slice a)instance monoidSlice :: Monoid (Slice a)instance foldableSlice :: Foldable Sliceinstance eqSlice :: (Eq a) => Eq (Slice a)instance functorSlice :: Functor Sliceinstance applySlice :: Apply Sliceinstance applicativeSlice :: Applicative Sliceinstance bindSlice :: Bind Sliceinstance monadSlice :: Monad Sliceinstance altSlice :: Alt Sliceinstance plusSlice :: Plus Sliceinstance alternativeSlice :: Alternative Sliceinstance monadPlusSlice :: MonadPlus Slice