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

Safe HaskellNone
LanguageHaskell2010

Data.Sequences

Description

Warning: This module should be considered highly experimental.

Synopsis

Documentation

class (Integral (Index seq), GrowingAppend seq) => SemiSequence seq where Source

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 -> seq Source

reverse :: seq -> seq Source

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

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

cons :: Element seq -> seq -> seq Source

snoc :: seq -> Element seq -> seq Source

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

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

Sequence Laws:

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

Minimal complete definition

Nothing

Methods

fromList :: [Element seq] -> seq Source

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

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

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

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

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

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

take :: Index seq -> seq -> seq Source

unsafeTake :: Index seq -> seq -> seq Source

drop :: Index seq -> seq -> seq Source

unsafeDrop :: Index seq -> seq -> seq Source

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 -> seq Source

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

replicate :: Index seq -> Element seq -> seq Source

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

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 -> seq Source

initEx :: seq -> seq Source

unsafeTail :: seq -> seq Source

unsafeInit :: seq -> seq Source

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

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

defaultReverse :: IsSequence seq => seq -> seq Source

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

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

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

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

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

tailDef :: IsSequence seq => seq -> seq Source

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

initDef :: IsSequence seq => seq -> seq Source

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

class (IsSequence seq, Eq (Element seq)) => EqSequence seq where Source

Minimal complete definition

Nothing

Methods

stripPrefix :: seq -> seq -> Maybe seq Source

isPrefixOf :: seq -> seq -> Bool Source

stripSuffix :: seq -> seq -> Maybe seq Source

isSuffixOf :: seq -> seq -> Bool Source

isInfixOf :: seq -> seq -> Bool Source

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 -> Bool Source

notElem :: Element seq -> seq -> Bool Source

class (EqSequence seq, MonoFoldableOrd seq) => OrdSequence seq where Source

Minimal complete definition

Nothing

Methods

sort :: seq -> seq Source

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

Minimal complete definition

words, unwords, lines, unlines, toLower, toUpper, toCaseFold

Methods

words :: t -> [t] Source

unwords :: [t] -> t Source

lines :: t -> [t] Source

unlines :: [t] -> t Source

toLower :: t -> t Source

toUpper :: t -> t Source

toCaseFold :: t -> t Source

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

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

Instances

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

catMaybes :: (IsSequence (f (Maybe t)), Functor f, Element (f (Maybe t)) ~ Maybe t) => f (Maybe t) -> f t Source

Takes all of the Just values from a sequence of Maybe ts and concatenates them into an unboxed sequence of ts.

Since 0.6.2