Safe Haskell | None |
---|
Warning, this is Experimental!
Data.NonNull attempts to extend the concepts from
NonEmpty
to any IsSequence
.
NonNull
is for a sequence with 1 or more elements.
Stream
is for a NonNull
that supports efficient
modification of the front of the sequence.
This code is experimental and likely to change dramatically and future versions. Please send your feedback.
- class IsSequence seq => NonNull seq where
- data NotEmpty seq = NotEmpty {
- toSequence :: seq
- class NonNull seq => Stream seq where
Documentation
class IsSequence seq => NonNull seq whereSource
a NonNull sequence has 1 or more items
nsingleton :: Element seq -> NonEmpty seqSource
fromNonEmpty :: NonEmpty (Element seq) -> NonEmpty seqSource
nfilter :: (Element seq -> Bool) -> NonEmpty seq -> seqSource
like filter
, but starts with a NonNull
head :: NonEmpty seq -> Element seqSource
like Data.List, but not partial on a NonEmpty
tail :: NonEmpty seq -> seqSource
like Data.List, but not partial on a NonEmpty
last :: NonEmpty seq -> Element seqSource
like Data.List, but not partial on a NonEmpty
init :: NonEmpty seq -> seqSource
like Data.List, but not partial on a NonEmpty
a wrapper indicating there are 1 or more elements unwrap with toSequence
NotEmpty | |
|
class NonNull seq => Stream seq whereSource
a stream is a NonNull that supports efficient modification of the front of the sequence