SemiSequence was created to share code between IsSequence and NonNull.
Semi means SemiGroup
A SemiSequence can accommodate a SemiGroup such as NonEmpty or NonNull
A Monoid should be able to fill out IsSequence.
SemiSequence operations maintain the same type because they all maintain the same number of elements or increase them.
However, a decreasing function such as filter may change they type.
For example, from NonEmpty to '[]'
This type-changing function exists on NonNull as nfilter
filter and other such functions are placed in IsSequence
NOTE: Like GrowingAppend, ideally we'd have a Semigroup superclass
constraint here, but that would pull in more dependencies to this package
than desired.
Associated types
type family Index seqThe type of the index of a sequence.
Methods
intersperse :: Element seq -> seq -> seqintersperse takes an element and intersperses that element between the elements of the sequence.
> intersperse ',' "abcde" "a,b,c,d,e"reverse :: seq -> seqReverse a sequence
> reverse "hello world" "dlrow olleh"find :: (Element seq -> Bool) -> seq -> Maybe (Element seq)sortBy :: (Element seq -> Element seq -> Ordering) -> seq -> seqcons :: Element seq -> seq -> seqPrepend an element onto a sequence.
> 4 `cons` [1,2,3] [4,1,2,3]snoc :: seq -> Element seq -> seqAppend an element onto a sequence.
> [1,2,3] `snoc` 4 [1,2,3,4]
Instances12SemiSequence, …
SemiSequence ByteStringDefined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence ByteStringDefined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence TextDefined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence TextDefined in mono-traversable-1.0.21.0 · Data.SequencesStorable a => SemiSequence (Vector a)Defined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence (Seq a)Defined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence (NonEmpty a)Defined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence (Vector a)Defined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence (Vector a)Defined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence [a]Defined in mono-traversable-1.0.21.0 · Data.SequencesSemiSequence seq => SemiSequence (NonNull seq)Defined in mono-traversable-1.0.21.0 · Data.NonNullUnbox a => SemiSequence (Vector a)Defined in mono-traversable-1.0.21.0 · Data.Sequences