mono-traversable-0.4.0.2: Type classes for mapping, folding, and traversing monomorphic containers

Safe HaskellNone

Data.Sequences

Description

Warning: This module should be considered highly experimental.

Synopsis

Documentation

class (Integral (Index seq), GrowingAppend seq) => SemiSequence seq whereSource

SemiSequence was created to share code between IsSequence and NonNull. You should always use IsSequence or NonNull rather than using SemiSequence SemiSequence is exported so that you can define new instances of IsSequence or NonNull

Semi means SemiGroup A SemiSequence can accomodate a SemiGroup such as NonEmpty A Monoid should be able to fill out IsSequence

As a base for NonNull, a SemiSequence keeps the same type when increasing its number of elements. However, a decreasing function such as filter may change a NonNull type. For example, from NonEmpty to '[]' This exists on NonNull as nfilter

filter and other such functions are placed in IsSequence

Associated Types

type Index seq Source

Methods

intersperse :: Element seq -> seq -> seqSource

reverse :: seq -> seqSource

find :: (Element seq -> Bool) -> seq -> Maybe (Element seq)Source

sortBy :: (Element seq -> Element seq -> Ordering) -> seq -> seqSource

cons :: Element seq -> seq -> seqSource

snoc :: seq -> Element seq -> seqSource

singleton :: IsSequence seq => Element seq -> seqSource

class (Monoid seq, MonoTraversable seq, SemiSequence seq, MonoPointed seq) => IsSequence seq whereSource

Sequence Laws:

 fromList . otoList = id
 fromList (x <> y) = fromList x <> fromList y
 otoList (fromList x <> fromList y) = x <> y

Methods

fromList :: [Element seq] -> seqSource

break :: (Element seq -> Bool) -> seq -> (seq, seq)Source

span :: (Element seq -> Bool) -> seq -> (seq, seq)Source

dropWhile :: (Element seq -> Bool) -> seq -> seqSource

takeWhile :: (Element seq -> Bool) -> seq -> seqSource

splitAt :: Index seq -> seq -> (seq, seq)Source

unsafeSplitAt :: Index seq -> seq -> (seq, seq)Source

take :: Index seq -> seq -> seqSource

unsafeTake :: Index seq -> seq -> seqSource

drop :: Index seq -> seq -> seqSource

unsafeDrop :: Index seq -> seq -> seqSource

partition :: (Element seq -> Bool) -> seq -> (seq, seq)Source

uncons :: seq -> Maybe (Element seq, seq)Source

unsnoc :: seq -> Maybe (seq, Element seq)Source

filter :: (Element seq -> Bool) -> seq -> seqSource

filterM :: Monad m => (Element seq -> m Bool) -> seq -> m seqSource

replicate :: Index seq -> Element seq -> seqSource

replicateM :: Monad m => Index seq -> m (Element seq) -> m seqSource

groupBy :: (Element seq -> Element seq -> Bool) -> seq -> [seq]Source

groupAllOn :: Eq b => (Element seq -> b) -> seq -> [seq]Source

Similar to standard groupBy, but operates on the whole collection, not just the consecutive items.

subsequences :: seq -> [seq]Source

permutations :: seq -> [seq]Source

tailEx :: seq -> seqSource

initEx :: seq -> seqSource

unsafeTail :: seq -> seqSource

unsafeInit :: seq -> seqSource

defaultFind :: MonoFoldable seq => (Element seq -> Bool) -> seq -> Maybe (Element seq)Source

defaultIntersperse :: IsSequence seq => Element seq -> seq -> seqSource

defaultReverse :: IsSequence seq => seq -> seqSource

defaultSortBy :: IsSequence seq => (Element seq -> Element seq -> Ordering) -> seq -> seqSource

vectorSortBy :: Vector v e => (e -> e -> Ordering) -> v e -> v eSource

vectorSort :: (Vector v e, Ord e) => v e -> v eSource

defaultCons :: IsSequence seq => Element seq -> seq -> seqSource

defaultSnoc :: IsSequence seq => seq -> Element seq -> seqSource

tailDef :: IsSequence seq => seq -> seqSource

like Data.List.tail, but an input of mempty returns mempty

initDef :: IsSequence seq => seq -> seqSource

like Data.List.init, but an input of mempty returns mempty

class (IsSequence seq, Eq (Element seq)) => EqSequence seq whereSource

Methods

stripPrefix :: seq -> seq -> Maybe seqSource

isPrefixOf :: seq -> seq -> BoolSource

stripSuffix :: seq -> seq -> Maybe seqSource

isSuffixOf :: seq -> seq -> BoolSource

isInfixOf :: seq -> seq -> BoolSource

group :: seq -> [seq]Source

groupAll :: seq -> [seq]Source

Similar to standard group, but operates on the whole collection, not just the consecutive items.

elem :: Element seq -> seq -> BoolSource

notElem :: Element seq -> seq -> BoolSource

class (IsSequence t, IsString t, Element t ~ Char) => Textual t whereSource

Methods

words :: t -> [t]Source

unwords :: [t] -> tSource

lines :: t -> [t]Source

unlines :: [t] -> tSource

toLower :: t -> tSource

toUpper :: t -> tSource

toCaseFold :: t -> tSource

breakWord :: t -> (t, t)Source

breakLine :: t -> (t, t)Source

Instances

Textual Text 
Textual Text 
~ * c Char => Textual [c]