ListLike-4.5: Generic support for list-like structures

CopyrightCopyright (C) 2007 John Goerzen
LicenseBSD3
MaintainerJohn Lato <jwlato@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Data.ListLike.Base

Description

Generic operations over list-like structures

Written by John Goerzen, jgoerzen@complete.org

Synopsis

Documentation

class (FoldableLL full item, Monoid full) => ListLike full item | full -> item where Source #

The class implementing list-like functions.

It is worth noting that types such as Map can be instances of ListLike. Due to their specific ways of operating, they may not behave in the expected way in some cases. For instance, cons may not increase the size of a map if the key you have given is already in the map; it will just replace the value already there.

Implementators must define at least:

  • singleton
  • head
  • tail
  • null or genericLength

Methods

empty :: full Source #

The empty list

singleton :: item -> full Source #

Creates a single-element list out of an element

cons :: item -> full -> full Source #

Like (:) for lists: adds an element to the beginning of a list

snoc :: full -> item -> full Source #

Adds an element to the *end* of a ListLike.

append :: full -> full -> full Source #

Combines two lists. Like (++).

head :: full -> item Source #

Extracts the first element of a ListLike.

uncons :: full -> Maybe (item, full) Source #

Extract head and tail, return Nothing if empty

last :: full -> item Source #

Extracts the last element of a ListLike.

tail :: full -> full Source #

Gives all elements after the head.

init :: full -> full Source #

All elements of the list except the last one. See also inits.

null :: full -> Bool Source #

Tests whether the list is empty.

length :: full -> Int Source #

Length of the list. See also genericLength.

map :: ListLike full' item' => (item -> item') -> full -> full' Source #

Apply a function to each element, returning any other valid ListLike. rigidMap will always be at least as fast, if not faster, than this function and is recommended if it will work for your purposes. See also mapM.

rigidMap :: (item -> item) -> full -> full Source #

Like map, but without the possibility of changing the type of the item. This can have performance benefits for things such as ByteStrings, since it will let the ByteString use its native low-level map implementation.

reverse :: full -> full Source #

Reverse the elements in a list.

intersperse :: item -> full -> full Source #

Add an item between each element in the structure

concat :: (ListLike full' full, Monoid full) => full' -> full Source #

Flatten the structure.

concatMap :: ListLike full' item' => (item -> full') -> full -> full' Source #

Map a function over the items and concatenate the results. See also rigidConcatMap.

rigidConcatMap :: (item -> full) -> full -> full Source #

Like concatMap, but without the possibility of changing the type of the item. This can have performance benefits for some things such as ByteString.

any :: (item -> Bool) -> full -> Bool Source #

True if any items satisfy the function

all :: (item -> Bool) -> full -> Bool Source #

True if all items satisfy the function

maximum :: Ord item => full -> item Source #

The maximum value of the list

minimum :: Ord item => full -> item Source #

The minimum value of the list

replicate :: Int -> item -> full Source #

Generate a structure with the specified length with every element set to the item passed in. See also genericReplicate

take :: Int -> full -> full Source #

Takes the first n elements of the list. See also genericTake.

drop :: Int -> full -> full Source #

Drops the first n elements of the list. See also genericDrop

splitAt :: Int -> full -> (full, full) Source #

Equivalent to (take n xs, drop n xs). See also genericSplitAt.

takeWhile :: (item -> Bool) -> full -> full Source #

Returns all elements at start of list that satisfy the function.

dropWhile :: (item -> Bool) -> full -> full Source #

Drops all elements from the start of the list that satisfy the function.

dropWhileEnd :: (item -> Bool) -> full -> full Source #

Drops all elements from the end of the list that satisfy the function.

span :: (item -> Bool) -> full -> (full, full) Source #

The equivalent of (takeWhile f xs, dropWhile f xs)

break :: (item -> Bool) -> full -> (full, full) Source #

The equivalent of span (not . f)

group :: (ListLike full' full, Eq item) => full -> full' Source #

Split a list into sublists, each which contains equal arguments. For order-preserving types, concatenating these sublists will produce the original list. See also groupBy.

inits :: ListLike full' full => full -> full' Source #

All initial segments of the list, shortest first

tails :: ListLike full' full => full -> full' Source #

All final segnemts, longest first

isPrefixOf :: Eq item => full -> full -> Bool Source #

True when the first list is at the beginning of the second.

isSuffixOf :: Eq item => full -> full -> Bool Source #

True when the first list is at the beginning of the second.

isInfixOf :: Eq item => full -> full -> Bool Source #

True when the first list is wholly containted within the second

stripPrefix :: Eq item => full -> full -> Maybe full Source #

Remove a prefix from a listlike if possible

stripSuffix :: Eq item => full -> full -> Maybe full Source #

Remove a suffix from a listlike if possible

elem :: Eq item => item -> full -> Bool Source #

True if the item occurs in the list

notElem :: Eq item => item -> full -> Bool Source #

True if the item does not occur in the list

find :: (item -> Bool) -> full -> Maybe item Source #

Take a function and return the first matching element, or Nothing if there is no such element.

filter :: (item -> Bool) -> full -> full Source #

Returns only the elements that satisfy the function.

partition :: (item -> Bool) -> full -> (full, full) Source #

Returns the lists that do and do not satisfy the function. Same as (filter p xs, filter (not . p) xs)

index :: full -> Int -> item Source #

The element at 0-based index i. Raises an exception if i is out of bounds. Like (!!) for lists.

elemIndex :: Eq item => item -> full -> Maybe Int Source #

Returns the index of the element, if it exists.

elemIndices :: (Eq item, ListLike result Int) => item -> full -> result Source #

Returns the indices of the matching elements. See also findIndices

findIndex :: (item -> Bool) -> full -> Maybe Int Source #

Take a function and return the index of the first matching element, or Nothing if no element matches

findIndices :: ListLike result Int => (item -> Bool) -> full -> result Source #

Returns the indices of all elements satisfying the function

sequence :: (Monad m, ListLike fullinp (m item)) => fullinp -> m full Source #

Evaluate each action in the sequence and collect the results

mapM :: (Monad m, ListLike full' item') => (item -> m item') -> full -> m full' Source #

A map in monad space. Same as sequence . map

See also rigidMapM

rigidMapM :: Monad m => (item -> m item) -> full -> m full Source #

Like mapM, but without the possibility of changing the type of the item. This can have performance benefits with some types.

nub :: Eq item => full -> full Source #

Removes duplicate elements from the list. See also nubBy

delete :: Eq item => item -> full -> full Source #

Removes the first instance of the element from the list. See also deleteBy

deleteFirsts :: Eq item => full -> full -> full Source #

List difference. Removes from the first list the first instance of each element of the second list. See '(\)' and deleteFirstsBy

union :: Eq item => full -> full -> full Source #

List union: the set of elements that occur in either list. Duplicate elements in the first list will remain duplicate. See also unionBy.

intersect :: Eq item => full -> full -> full Source #

List intersection: the set of elements that occur in both lists. See also intersectBy

sort :: Ord item => full -> full Source #

Sorts the list. On data types that do not preserve ordering, or enforce their own ordering, the result may not be what you expect. See also sortBy.

insert :: Ord item => item -> full -> full Source #

Inserts the element at the last place where it is still less than or equal to the next element. On data types that do not preserve ordering, or enforce their own ordering, the result may not be what you expect. On types such as maps, this may result in changing an existing item. See also insertBy.

toList :: full -> [item] Source #

Converts the structure to a list. This is logically equivolent to fromListLike, but may have a more optimized implementation.

fromList :: [item] -> full Source #

Generates the structure from a list.

fromListLike :: ListLike full' item => full -> full' Source #

Converts one ListLike to another. See also toList. Default implementation is fromListLike = map id

nubBy :: (item -> item -> Bool) -> full -> full Source #

Generic version of nub

deleteBy :: (item -> item -> Bool) -> item -> full -> full Source #

Generic version of deleteBy

deleteFirstsBy :: (item -> item -> Bool) -> full -> full -> full Source #

Generic version of deleteFirsts

unionBy :: (item -> item -> Bool) -> full -> full -> full Source #

Generic version of union

intersectBy :: (item -> item -> Bool) -> full -> full -> full Source #

Generic version of intersect

groupBy :: (ListLike full' full, Eq item) => (item -> item -> Bool) -> full -> full' Source #

Generic version of group.

sortBy :: (item -> item -> Ordering) -> full -> full Source #

Sort function taking a custom comparison function

insertBy :: (item -> item -> Ordering) -> item -> full -> full Source #

Like insert, but with a custom comparison function

genericLength :: Num a => full -> a Source #

Length of the list

genericTake :: Integral a => a -> full -> full Source #

Generic version of take

genericDrop :: Integral a => a -> full -> full Source #

Generic version of drop

genericSplitAt :: Integral a => a -> full -> (full, full) Source #

Generic version of splitAt

genericReplicate :: Integral a => a -> item -> full Source #

Generic version of replicate

Instances

ListLike CharStringLazy Char Source # 

Methods

empty :: CharStringLazy Source #

singleton :: Char -> CharStringLazy Source #

cons :: Char -> CharStringLazy -> CharStringLazy Source #

snoc :: CharStringLazy -> Char -> CharStringLazy Source #

append :: CharStringLazy -> CharStringLazy -> CharStringLazy Source #

head :: CharStringLazy -> Char Source #

uncons :: CharStringLazy -> Maybe (Char, CharStringLazy) Source #

last :: CharStringLazy -> Char Source #

tail :: CharStringLazy -> CharStringLazy Source #

init :: CharStringLazy -> CharStringLazy Source #

null :: CharStringLazy -> Bool Source #

length :: CharStringLazy -> Int Source #

map :: ListLike full' item' => (Char -> item') -> CharStringLazy -> full' Source #

rigidMap :: (Char -> Char) -> CharStringLazy -> CharStringLazy Source #

reverse :: CharStringLazy -> CharStringLazy Source #

intersperse :: Char -> CharStringLazy -> CharStringLazy Source #

concat :: (ListLike full' CharStringLazy, Monoid CharStringLazy) => full' -> CharStringLazy Source #

concatMap :: ListLike full' item' => (Char -> full') -> CharStringLazy -> full' Source #

rigidConcatMap :: (Char -> CharStringLazy) -> CharStringLazy -> CharStringLazy Source #

any :: (Char -> Bool) -> CharStringLazy -> Bool Source #

all :: (Char -> Bool) -> CharStringLazy -> Bool Source #

maximum :: CharStringLazy -> Char Source #

minimum :: CharStringLazy -> Char Source #

replicate :: Int -> Char -> CharStringLazy Source #

take :: Int -> CharStringLazy -> CharStringLazy Source #

drop :: Int -> CharStringLazy -> CharStringLazy Source #

splitAt :: Int -> CharStringLazy -> (CharStringLazy, CharStringLazy) Source #

takeWhile :: (Char -> Bool) -> CharStringLazy -> CharStringLazy Source #

dropWhile :: (Char -> Bool) -> CharStringLazy -> CharStringLazy Source #

dropWhileEnd :: (Char -> Bool) -> CharStringLazy -> CharStringLazy Source #

span :: (Char -> Bool) -> CharStringLazy -> (CharStringLazy, CharStringLazy) Source #

break :: (Char -> Bool) -> CharStringLazy -> (CharStringLazy, CharStringLazy) Source #

group :: (ListLike full' CharStringLazy, Eq Char) => CharStringLazy -> full' Source #

inits :: ListLike full' CharStringLazy => CharStringLazy -> full' Source #

tails :: ListLike full' CharStringLazy => CharStringLazy -> full' Source #

isPrefixOf :: CharStringLazy -> CharStringLazy -> Bool Source #

isSuffixOf :: CharStringLazy -> CharStringLazy -> Bool Source #

isInfixOf :: CharStringLazy -> CharStringLazy -> Bool Source #

stripPrefix :: CharStringLazy -> CharStringLazy -> Maybe CharStringLazy Source #

stripSuffix :: CharStringLazy -> CharStringLazy -> Maybe CharStringLazy Source #

elem :: Char -> CharStringLazy -> Bool Source #

notElem :: Char -> CharStringLazy -> Bool Source #

find :: (Char -> Bool) -> CharStringLazy -> Maybe Char Source #

filter :: (Char -> Bool) -> CharStringLazy -> CharStringLazy Source #

partition :: (Char -> Bool) -> CharStringLazy -> (CharStringLazy, CharStringLazy) Source #

index :: CharStringLazy -> Int -> Char Source #

elemIndex :: Char -> CharStringLazy -> Maybe Int Source #

elemIndices :: (Eq Char, ListLike result Int) => Char -> CharStringLazy -> result Source #

findIndex :: (Char -> Bool) -> CharStringLazy -> Maybe Int Source #

findIndices :: ListLike result Int => (Char -> Bool) -> CharStringLazy -> result Source #

sequence :: (Monad m, ListLike fullinp (m Char)) => fullinp -> m CharStringLazy Source #

mapM :: (Monad m, ListLike full' item') => (Char -> m item') -> CharStringLazy -> m full' Source #

rigidMapM :: Monad m => (Char -> m Char) -> CharStringLazy -> m CharStringLazy Source #

nub :: CharStringLazy -> CharStringLazy Source #

delete :: Char -> CharStringLazy -> CharStringLazy Source #

deleteFirsts :: CharStringLazy -> CharStringLazy -> CharStringLazy Source #

union :: CharStringLazy -> CharStringLazy -> CharStringLazy Source #

intersect :: CharStringLazy -> CharStringLazy -> CharStringLazy Source #

sort :: CharStringLazy -> CharStringLazy Source #

insert :: Char -> CharStringLazy -> CharStringLazy Source #

toList :: CharStringLazy -> [Char] Source #

fromList :: [Char] -> CharStringLazy Source #

fromListLike :: ListLike full' Char => CharStringLazy -> full' Source #

nubBy :: (Char -> Char -> Bool) -> CharStringLazy -> CharStringLazy Source #

deleteBy :: (Char -> Char -> Bool) -> Char -> CharStringLazy -> CharStringLazy Source #

deleteFirstsBy :: (Char -> Char -> Bool) -> CharStringLazy -> CharStringLazy -> CharStringLazy Source #

unionBy :: (Char -> Char -> Bool) -> CharStringLazy -> CharStringLazy -> CharStringLazy Source #

intersectBy :: (Char -> Char -> Bool) -> CharStringLazy -> CharStringLazy -> CharStringLazy Source #

groupBy :: (ListLike full' CharStringLazy, Eq Char) => (Char -> Char -> Bool) -> CharStringLazy -> full' Source #

sortBy :: (Char -> Char -> Ordering) -> CharStringLazy -> CharStringLazy Source #

insertBy :: (Char -> Char -> Ordering) -> Char -> CharStringLazy -> CharStringLazy Source #

genericLength :: Num a => CharStringLazy -> a Source #

genericTake :: Integral a => a -> CharStringLazy -> CharStringLazy Source #

genericDrop :: Integral a => a -> CharStringLazy -> CharStringLazy Source #

genericSplitAt :: Integral a => a -> CharStringLazy -> (CharStringLazy, CharStringLazy) Source #

genericReplicate :: Integral a => a -> Char -> CharStringLazy Source #

ListLike CharString Char Source # 

Methods

empty :: CharString Source #

singleton :: Char -> CharString Source #

cons :: Char -> CharString -> CharString Source #

snoc :: CharString -> Char -> CharString Source #

append :: CharString -> CharString -> CharString Source #

head :: CharString -> Char Source #

uncons :: CharString -> Maybe (Char, CharString) Source #

last :: CharString -> Char Source #

tail :: CharString -> CharString Source #

init :: CharString -> CharString Source #

null :: CharString -> Bool Source #

length :: CharString -> Int Source #

map :: ListLike full' item' => (Char -> item') -> CharString -> full' Source #

rigidMap :: (Char -> Char) -> CharString -> CharString Source #

reverse :: CharString -> CharString Source #

intersperse :: Char -> CharString -> CharString Source #

concat :: (ListLike full' CharString, Monoid CharString) => full' -> CharString Source #

concatMap :: ListLike full' item' => (Char -> full') -> CharString -> full' Source #

rigidConcatMap :: (Char -> CharString) -> CharString -> CharString Source #

any :: (Char -> Bool) -> CharString -> Bool Source #

all :: (Char -> Bool) -> CharString -> Bool Source #

maximum :: CharString -> Char Source #

minimum :: CharString -> Char Source #

replicate :: Int -> Char -> CharString Source #

take :: Int -> CharString -> CharString Source #

drop :: Int -> CharString -> CharString Source #

splitAt :: Int -> CharString -> (CharString, CharString) Source #

takeWhile :: (Char -> Bool) -> CharString -> CharString Source #

dropWhile :: (Char -> Bool) -> CharString -> CharString Source #

dropWhileEnd :: (Char -> Bool) -> CharString -> CharString Source #

span :: (Char -> Bool) -> CharString -> (CharString, CharString) Source #

break :: (Char -> Bool) -> CharString -> (CharString, CharString) Source #

group :: (ListLike full' CharString, Eq Char) => CharString -> full' Source #

inits :: ListLike full' CharString => CharString -> full' Source #

tails :: ListLike full' CharString => CharString -> full' Source #

isPrefixOf :: CharString -> CharString -> Bool Source #

isSuffixOf :: CharString -> CharString -> Bool Source #

isInfixOf :: CharString -> CharString -> Bool Source #

stripPrefix :: CharString -> CharString -> Maybe CharString Source #

stripSuffix :: CharString -> CharString -> Maybe CharString Source #

elem :: Char -> CharString -> Bool Source #

notElem :: Char -> CharString -> Bool Source #

find :: (Char -> Bool) -> CharString -> Maybe Char Source #

filter :: (Char -> Bool) -> CharString -> CharString Source #

partition :: (Char -> Bool) -> CharString -> (CharString, CharString) Source #

index :: CharString -> Int -> Char Source #

elemIndex :: Char -> CharString -> Maybe Int Source #

elemIndices :: (Eq Char, ListLike result Int) => Char -> CharString -> result Source #

findIndex :: (Char -> Bool) -> CharString -> Maybe Int Source #

findIndices :: ListLike result Int => (Char -> Bool) -> CharString -> result Source #

sequence :: (Monad m, ListLike fullinp (m Char)) => fullinp -> m CharString Source #

mapM :: (Monad m, ListLike full' item') => (Char -> m item') -> CharString -> m full' Source #

rigidMapM :: Monad m => (Char -> m Char) -> CharString -> m CharString Source #

nub :: CharString -> CharString Source #

delete :: Char -> CharString -> CharString Source #

deleteFirsts :: CharString -> CharString -> CharString Source #

union :: CharString -> CharString -> CharString Source #

intersect :: CharString -> CharString -> CharString Source #

sort :: CharString -> CharString Source #

insert :: Char -> CharString -> CharString Source #

toList :: CharString -> [Char] Source #

fromList :: [Char] -> CharString Source #

fromListLike :: ListLike full' Char => CharString -> full' Source #

nubBy :: (Char -> Char -> Bool) -> CharString -> CharString Source #

deleteBy :: (Char -> Char -> Bool) -> Char -> CharString -> CharString Source #

deleteFirstsBy :: (Char -> Char -> Bool) -> CharString -> CharString -> CharString Source #

unionBy :: (Char -> Char -> Bool) -> CharString -> CharString -> CharString Source #

intersectBy :: (Char -> Char -> Bool) -> CharString -> CharString -> CharString Source #

groupBy :: (ListLike full' CharString, Eq Char) => (Char -> Char -> Bool) -> CharString -> full' Source #

sortBy :: (Char -> Char -> Ordering) -> CharString -> CharString Source #

insertBy :: (Char -> Char -> Ordering) -> Char -> CharString -> CharString Source #

genericLength :: Num a => CharString -> a Source #

genericTake :: Integral a => a -> CharString -> CharString Source #

genericDrop :: Integral a => a -> CharString -> CharString Source #

genericSplitAt :: Integral a => a -> CharString -> (CharString, CharString) Source #

genericReplicate :: Integral a => a -> Char -> CharString Source #

ListLike Chars Char Source # 

Methods

empty :: Chars Source #

singleton :: Char -> Chars Source #

cons :: Char -> Chars -> Chars Source #

snoc :: Chars -> Char -> Chars Source #

append :: Chars -> Chars -> Chars Source #

head :: Chars -> Char Source #

uncons :: Chars -> Maybe (Char, Chars) Source #

last :: Chars -> Char Source #

tail :: Chars -> Chars Source #

init :: Chars -> Chars Source #

null :: Chars -> Bool Source #

length :: Chars -> Int Source #

map :: ListLike full' item' => (Char -> item') -> Chars -> full' Source #

rigidMap :: (Char -> Char) -> Chars -> Chars Source #

reverse :: Chars -> Chars Source #

intersperse :: Char -> Chars -> Chars Source #

concat :: (ListLike full' Chars, Monoid Chars) => full' -> Chars Source #

concatMap :: ListLike full' item' => (Char -> full') -> Chars -> full' Source #

rigidConcatMap :: (Char -> Chars) -> Chars -> Chars Source #

any :: (Char -> Bool) -> Chars -> Bool Source #

all :: (Char -> Bool) -> Chars -> Bool Source #

maximum :: Chars -> Char Source #

minimum :: Chars -> Char Source #

replicate :: Int -> Char -> Chars Source #

take :: Int -> Chars -> Chars Source #

drop :: Int -> Chars -> Chars Source #

splitAt :: Int -> Chars -> (Chars, Chars) Source #

takeWhile :: (Char -> Bool) -> Chars -> Chars Source #

dropWhile :: (Char -> Bool) -> Chars -> Chars Source #

dropWhileEnd :: (Char -> Bool) -> Chars -> Chars Source #

span :: (Char -> Bool) -> Chars -> (Chars, Chars) Source #

break :: (Char -> Bool) -> Chars -> (Chars, Chars) Source #

group :: (ListLike full' Chars, Eq Char) => Chars -> full' Source #

inits :: ListLike full' Chars => Chars -> full' Source #

tails :: ListLike full' Chars => Chars -> full' Source #

isPrefixOf :: Chars -> Chars -> Bool Source #

isSuffixOf :: Chars -> Chars -> Bool Source #

isInfixOf :: Chars -> Chars -> Bool Source #

stripPrefix :: Chars -> Chars -> Maybe Chars Source #

stripSuffix :: Chars -> Chars -> Maybe Chars Source #

elem :: Char -> Chars -> Bool Source #

notElem :: Char -> Chars -> Bool Source #

find :: (Char -> Bool) -> Chars -> Maybe Char Source #

filter :: (Char -> Bool) -> Chars -> Chars Source #

partition :: (Char -> Bool) -> Chars -> (Chars, Chars) Source #

index :: Chars -> Int -> Char Source #

elemIndex :: Char -> Chars -> Maybe Int Source #

elemIndices :: (Eq Char, ListLike result Int) => Char -> Chars -> result Source #

findIndex :: (Char -> Bool) -> Chars -> Maybe Int Source #

findIndices :: ListLike result Int => (Char -> Bool) -> Chars -> result Source #

sequence :: (Monad m, ListLike fullinp (m Char)) => fullinp -> m Chars Source #

mapM :: (Monad m, ListLike full' item') => (Char -> m item') -> Chars -> m full' Source #

rigidMapM :: Monad m => (Char -> m Char) -> Chars -> m Chars Source #

nub :: Chars -> Chars Source #

delete :: Char -> Chars -> Chars Source #

deleteFirsts :: Chars -> Chars -> Chars Source #

union :: Chars -> Chars -> Chars Source #

intersect :: Chars -> Chars -> Chars Source #

sort :: Chars -> Chars Source #

insert :: Char -> Chars -> Chars Source #

toList :: Chars -> [Char] Source #

fromList :: [Char] -> Chars Source #

fromListLike :: ListLike full' Char => Chars -> full' Source #

nubBy :: (Char -> Char -> Bool) -> Chars -> Chars Source #

deleteBy :: (Char -> Char -> Bool) -> Char -> Chars -> Chars Source #

deleteFirstsBy :: (Char -> Char -> Bool) -> Chars -> Chars -> Chars Source #

unionBy :: (Char -> Char -> Bool) -> Chars -> Chars -> Chars Source #

intersectBy :: (Char -> Char -> Bool) -> Chars -> Chars -> Chars Source #

groupBy :: (ListLike full' Chars, Eq Char) => (Char -> Char -> Bool) -> Chars -> full' Source #

sortBy :: (Char -> Char -> Ordering) -> Chars -> Chars Source #

insertBy :: (Char -> Char -> Ordering) -> Char -> Chars -> Chars Source #

genericLength :: Num a => Chars -> a Source #

genericTake :: Integral a => a -> Chars -> Chars Source #

genericDrop :: Integral a => a -> Chars -> Chars Source #

genericSplitAt :: Integral a => a -> Chars -> (Chars, Chars) Source #

genericReplicate :: Integral a => a -> Char -> Chars Source #

ListLike [a] a Source # 

Methods

empty :: [a] Source #

singleton :: a -> [a] Source #

cons :: a -> [a] -> [a] Source #

snoc :: [a] -> a -> [a] Source #

append :: [a] -> [a] -> [a] Source #

head :: [a] -> a Source #

uncons :: [a] -> Maybe (a, [a]) Source #

last :: [a] -> a Source #

tail :: [a] -> [a] Source #

init :: [a] -> [a] Source #

null :: [a] -> Bool Source #

length :: [a] -> Int Source #

map :: ListLike full' item' => (a -> item') -> [a] -> full' Source #

rigidMap :: (a -> a) -> [a] -> [a] Source #

reverse :: [a] -> [a] Source #

intersperse :: a -> [a] -> [a] Source #

concat :: (ListLike full' [a], Monoid [a]) => full' -> [a] Source #

concatMap :: ListLike full' item' => (a -> full') -> [a] -> full' Source #

rigidConcatMap :: (a -> [a]) -> [a] -> [a] Source #

any :: (a -> Bool) -> [a] -> Bool Source #

all :: (a -> Bool) -> [a] -> Bool Source #

maximum :: [a] -> a Source #

minimum :: [a] -> a Source #

replicate :: Int -> a -> [a] Source #

take :: Int -> [a] -> [a] Source #

drop :: Int -> [a] -> [a] Source #

splitAt :: Int -> [a] -> ([a], [a]) Source #

takeWhile :: (a -> Bool) -> [a] -> [a] Source #

dropWhile :: (a -> Bool) -> [a] -> [a] Source #

dropWhileEnd :: (a -> Bool) -> [a] -> [a] Source #

span :: (a -> Bool) -> [a] -> ([a], [a]) Source #

break :: (a -> Bool) -> [a] -> ([a], [a]) Source #

group :: (ListLike full' [a], Eq a) => [a] -> full' Source #

inits :: ListLike full' [a] => [a] -> full' Source #

tails :: ListLike full' [a] => [a] -> full' Source #

isPrefixOf :: [a] -> [a] -> Bool Source #

isSuffixOf :: [a] -> [a] -> Bool Source #

isInfixOf :: [a] -> [a] -> Bool Source #

stripPrefix :: [a] -> [a] -> Maybe [a] Source #

stripSuffix :: [a] -> [a] -> Maybe [a] Source #

elem :: a -> [a] -> Bool Source #

notElem :: a -> [a] -> Bool Source #

find :: (a -> Bool) -> [a] -> Maybe a Source #

filter :: (a -> Bool) -> [a] -> [a] Source #

partition :: (a -> Bool) -> [a] -> ([a], [a]) Source #

index :: [a] -> Int -> a Source #

elemIndex :: a -> [a] -> Maybe Int Source #

elemIndices :: (Eq a, ListLike result Int) => a -> [a] -> result Source #

findIndex :: (a -> Bool) -> [a] -> Maybe Int Source #

findIndices :: ListLike result Int => (a -> Bool) -> [a] -> result Source #

sequence :: (Monad m, ListLike fullinp (m a)) => fullinp -> m [a] Source #

mapM :: (Monad m, ListLike full' item') => (a -> m item') -> [a] -> m full' Source #

rigidMapM :: Monad m => (a -> m a) -> [a] -> m [a] Source #

nub :: [a] -> [a] Source #

delete :: a -> [a] -> [a] Source #

deleteFirsts :: [a] -> [a] -> [a] Source #

union :: [a] -> [a] -> [a] Source #

intersect :: [a] -> [a] -> [a] Source #

sort :: [a] -> [a] Source #

insert :: a -> [a] -> [a] Source #

toList :: [a] -> [a] Source #

fromList :: [a] -> [a] Source #

fromListLike :: ListLike full' a => [a] -> full' Source #

nubBy :: (a -> a -> Bool) -> [a] -> [a] Source #

deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a] Source #

deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] Source #

unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] Source #

intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] Source #

groupBy :: (ListLike full' [a], Eq a) => (a -> a -> Bool) -> [a] -> full' Source #

sortBy :: (a -> a -> Ordering) -> [a] -> [a] Source #

insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a] Source #

genericLength :: Num a => [a] -> a Source #

genericTake :: Integral a => a -> [a] -> [a] Source #

genericDrop :: Integral a => a -> [a] -> [a] Source #

genericSplitAt :: Integral a => a -> [a] -> ([a], [a]) Source #

genericReplicate :: Integral a => a -> a -> [a] Source #

class ListLike full item => InfiniteListLike full item | full -> item where Source #

An extension to ListLike for those data types that are capable of dealing with infinite lists. Some ListLike functions are capable of working with finite or infinite lists. The functions here require infinite list capability in order to work at all.

Methods

iterate :: (item -> item) -> item -> full Source #

An infinite list of repeated calls of the function to args

repeat :: item -> full Source #

An infinite list where each element is the same

cycle :: full -> full Source #

Converts a finite list into a circular one

zip :: (ListLike full item, ListLike fullb itemb, ListLike result (item, itemb)) => full -> fullb -> result Source #

Takes two lists and returns a list of corresponding pairs.

zipWith :: (ListLike full item, ListLike fullb itemb, ListLike result resultitem) => (item -> itemb -> resultitem) -> full -> fullb -> result Source #

Takes two lists and combines them with a custom combining function

sequence_ :: (Monad m, FoldableLL full (m item)) => full -> m () Source #

Evaluate each action, ignoring the results. Same as mapM_ id.