Module
Data.Sequence.NonEmpty
- Package
- purescript-sequences
- Repository
- hdgarrood/purescript-sequences
This module contains a type, Seq
, much like that from Data.Sequence
,
but which is guaranteed to contain at least one element.
This module is intended to be imported qualified, to avoid name clashes or ambiguity. For example:
import Data.Sequence.NonEmpty as NonEmpty
#splitAt Source
splitAt :: forall a. Int -> Seq a -> Tuple (Seq a) (Seq a)
O(log(min(i,n-i))). Split the sequence into two (possibly empty) subsequences. The first subsequence will have i elements (unless there are not that many in the whole sequence, in which case the first element is the same sequence, unchanged).
#toUnfoldable Source
toUnfoldable :: forall f. Functor f => Unfoldable f => Seq ~> f
Probably O(n), but depends on the Unfoldable instance. Turn a Seq
into
any Unfoldable
.