ListLike-4.5.1: Generic support for list-like structures

Copyright | Copyright (C) 2007 John Goerzen
License | BSD3
Maintainer | John Lato <jwlato@gmail.com>
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Data.ListLike.Base

Description

Generic operations over list-like structures

Written by John Goerzen, jgoerzen@complete.org

Synopsis

- class (FoldableLL full item, Monoid full) => ListLike full item | full -> item where
- class ListLike full item => InfiniteListLike full item | full -> item where
- zip :: (ListLike full item, ListLike fullb itemb, ListLike result (item, itemb)) => full -> fullb -> result
- zipWith :: (ListLike full item, ListLike fullb itemb, ListLike result resultitem) => (item -> itemb -> resultitem) -> full -> fullb -> result
- sequence_ :: (Monad m, FoldableLL full (m item)) => full -> m ()

# Documentation

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

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

Minimal complete definition

singleton, uncons, null | singleton, uncons, genericLength | singleton, head, tail, null | singleton, head, tail, genericLength

Methods

empty :: full #

The empty list

singleton :: item -> full #

Creates a single-element list out of an element

cons :: item -> full -> full #

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

snoc :: full -> item -> full #

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

append :: full -> full -> full #

Combines two lists. Like (++).

head :: full -> item #

Extracts the first element of a `ListLike`.

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

Extract head and tail, return Nothing if empty

last :: full -> item #

Extracts the last element of a `ListLike`.

tail :: full -> full #

Gives all elements after the head.

init :: full -> full #

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

null :: full -> Bool #

Tests whether the list is empty.

length :: full -> Int #

Length of the list. See also `genericLength`.

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

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 #

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 #

Reverse the elements in a list.

intersperse :: item -> full -> full #

Add an item between each element in the structure

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

Flatten the structure.

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

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

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

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 #

True if any items satisfy the function

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

True if all items satisfy the function

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

The maximum value of the list

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

The minimum value of the list

replicate :: Int -> item -> full #

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

take :: Int -> full -> full #

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

drop :: Int -> full -> full #

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

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

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

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

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

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

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

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

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

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

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

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

The equivalent of ``span` (`not` . f)`

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

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' #

All initial segments of the list, shortest first

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

All final segnemts, longest first

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

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

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

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

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

True when the first list is wholly containted within the second

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

Remove a prefix from a listlike if possible

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

Remove a suffix from a listlike if possible

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

True if the item occurs in the list

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

True if the item does not occur in the list

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

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

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

Returns only the elements that satisfy the function.

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

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

index :: full -> Int -> item #

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 #

Returns the index of the element, if it exists.

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

Returns the indices of the matching elements. See also `findIndices`

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

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 #

Returns the indices of all elements satisfying the function

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

Evaluate each action in the sequence and collect the results

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

A map in monad space. Same as ``sequence` . `map``

See also `rigidMapM`

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

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 #

Removes duplicate elements from the list. See also `nubBy`

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

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

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

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 #

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 #

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

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

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 #

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] #

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

fromList :: [item] -> full #

Generates the structure from a list.

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

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

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

Generic version of `nub`

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

Generic version of `deleteBy`

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

Generic version of `deleteFirsts`

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

Generic version of `union`

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

Generic version of `intersect`

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

Generic version of `group`.

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

Sort function taking a custom comparison function

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

Like `insert`, but with a custom comparison function

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

Length of the list

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

Generic version of `take`

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

Generic version of `drop`

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

Generic version of `splitAt`

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

Generic version of `replicate`

Instances

ListLike CharStringLazy Char # |
Methods empty :: CharStringLazy # singleton :: Char -> CharStringLazy # cons :: Char -> CharStringLazy -> CharStringLazy # snoc :: CharStringLazy -> Char -> CharStringLazy # append :: CharStringLazy -> CharStringLazy -> CharStringLazy # head :: CharStringLazy -> Char # uncons :: CharStringLazy -> Maybe (Char, CharStringLazy) # last :: CharStringLazy -> Char # tail :: CharStringLazy -> CharStringLazy # init :: CharStringLazy -> CharStringLazy # null :: CharStringLazy -> Bool # length :: CharStringLazy -> Int # map :: ListLike full' item' => (Char -> item') -> CharStringLazy -> full' # rigidMap :: (Char -> Char) -> CharStringLazy -> CharStringLazy # reverse :: CharStringLazy -> CharStringLazy # intersperse :: Char -> CharStringLazy -> CharStringLazy # concat :: (ListLike full' CharStringLazy, Monoid CharStringLazy) => full' -> CharStringLazy # concatMap :: ListLike full' item' => (Char -> full') -> CharStringLazy -> full' # rigidConcatMap :: (Char -> CharStringLazy) -> CharStringLazy -> CharStringLazy # any :: (Char -> Bool) -> CharStringLazy -> Bool # all :: (Char -> Bool) -> CharStringLazy -> Bool # maximum :: CharStringLazy -> Char # minimum :: CharStringLazy -> Char # replicate :: Int -> Char -> CharStringLazy # take :: Int -> CharStringLazy -> CharStringLazy # drop :: Int -> CharStringLazy -> CharStringLazy # splitAt :: Int -> CharStringLazy -> (CharStringLazy, CharStringLazy) # takeWhile :: (Char -> Bool) -> CharStringLazy -> CharStringLazy # dropWhile :: (Char -> Bool) -> CharStringLazy -> CharStringLazy # dropWhileEnd :: (Char -> Bool) -> CharStringLazy -> CharStringLazy # span :: (Char -> Bool) -> CharStringLazy -> (CharStringLazy, CharStringLazy) # break :: (Char -> Bool) -> CharStringLazy -> (CharStringLazy, CharStringLazy) # group :: (ListLike full' CharStringLazy, Eq Char) => CharStringLazy -> full' # inits :: ListLike full' CharStringLazy => CharStringLazy -> full' # tails :: ListLike full' CharStringLazy => CharStringLazy -> full' # isPrefixOf :: CharStringLazy -> CharStringLazy -> Bool # isSuffixOf :: CharStringLazy -> CharStringLazy -> Bool # isInfixOf :: CharStringLazy -> CharStringLazy -> Bool # stripPrefix :: CharStringLazy -> CharStringLazy -> Maybe CharStringLazy # stripSuffix :: CharStringLazy -> CharStringLazy -> Maybe CharStringLazy # elem :: Char -> CharStringLazy -> Bool # notElem :: Char -> CharStringLazy -> Bool # find :: (Char -> Bool) -> CharStringLazy -> Maybe Char # filter :: (Char -> Bool) -> CharStringLazy -> CharStringLazy # partition :: (Char -> Bool) -> CharStringLazy -> (CharStringLazy, CharStringLazy) # index :: CharStringLazy -> Int -> Char # elemIndex :: Char -> CharStringLazy -> Maybe Int # elemIndices :: (Eq Char, ListLike result Int) => Char -> CharStringLazy -> result # findIndex :: (Char -> Bool) -> CharStringLazy -> Maybe Int # findIndices :: ListLike result Int => (Char -> Bool) -> CharStringLazy -> result # sequence :: (Monad m, ListLike fullinp (m Char)) => fullinp -> m CharStringLazy # mapM :: (Monad m, ListLike full' item') => (Char -> m item') -> CharStringLazy -> m full' # rigidMapM :: Monad m => (Char -> m Char) -> CharStringLazy -> m CharStringLazy # nub :: CharStringLazy -> CharStringLazy # delete :: Char -> CharStringLazy -> CharStringLazy # deleteFirsts :: CharStringLazy -> CharStringLazy -> CharStringLazy # union :: CharStringLazy -> CharStringLazy -> CharStringLazy # intersect :: CharStringLazy -> CharStringLazy -> CharStringLazy # sort :: CharStringLazy -> CharStringLazy # insert :: Char -> CharStringLazy -> CharStringLazy # toList :: CharStringLazy -> [Char] # fromList :: [Char] -> CharStringLazy # fromListLike :: ListLike full' Char => CharStringLazy -> full' # nubBy :: (Char -> Char -> Bool) -> CharStringLazy -> CharStringLazy # deleteBy :: (Char -> Char -> Bool) -> Char -> CharStringLazy -> CharStringLazy # deleteFirstsBy :: (Char -> Char -> Bool) -> CharStringLazy -> CharStringLazy -> CharStringLazy # unionBy :: (Char -> Char -> Bool) -> CharStringLazy -> CharStringLazy -> CharStringLazy # intersectBy :: (Char -> Char -> Bool) -> CharStringLazy -> CharStringLazy -> CharStringLazy # groupBy :: (ListLike full' CharStringLazy, Eq Char) => (Char -> Char -> Bool) -> CharStringLazy -> full' # sortBy :: (Char -> Char -> Ordering) -> CharStringLazy -> CharStringLazy # insertBy :: (Char -> Char -> Ordering) -> Char -> CharStringLazy -> CharStringLazy # genericLength :: Num a => CharStringLazy -> a # genericTake :: Integral a => a -> CharStringLazy -> CharStringLazy # genericDrop :: Integral a => a -> CharStringLazy -> CharStringLazy # genericSplitAt :: Integral a => a -> CharStringLazy -> (CharStringLazy, CharStringLazy) # genericReplicate :: Integral a => a -> Char -> CharStringLazy #
ListLike CharString Char # |
Methods empty :: CharString # singleton :: Char -> CharString # cons :: Char -> CharString -> CharString # snoc :: CharString -> Char -> CharString # append :: CharString -> CharString -> CharString # head :: CharString -> Char # uncons :: CharString -> Maybe (Char, CharString) # last :: CharString -> Char # tail :: CharString -> CharString # init :: CharString -> CharString # null :: CharString -> Bool # length :: CharString -> Int # map :: ListLike full' item' => (Char -> item') -> CharString -> full' # rigidMap :: (Char -> Char) -> CharString -> CharString # reverse :: CharString -> CharString # intersperse :: Char -> CharString -> CharString # concat :: (ListLike full' CharString, Monoid CharString) => full' -> CharString # concatMap :: ListLike full' item' => (Char -> full') -> CharString -> full' # rigidConcatMap :: (Char -> CharString) -> CharString -> CharString # any :: (Char -> Bool) -> CharString -> Bool # all :: (Char -> Bool) -> CharString -> Bool # maximum :: CharString -> Char # minimum :: CharString -> Char # replicate :: Int -> Char -> CharString # take :: Int -> CharString -> CharString # drop :: Int -> CharString -> CharString # splitAt :: Int -> CharString -> (CharString, CharString) # takeWhile :: (Char -> Bool) -> CharString -> CharString # dropWhile :: (Char -> Bool) -> CharString -> CharString # dropWhileEnd :: (Char -> Bool) -> CharString -> CharString # span :: (Char -> Bool) -> CharString -> (CharString, CharString) # break :: (Char -> Bool) -> CharString -> (CharString, CharString) # group :: (ListLike full' CharString, Eq Char) => CharString -> full' # inits :: ListLike full' CharString => CharString -> full' # tails :: ListLike full' CharString => CharString -> full' # isPrefixOf :: CharString -> CharString -> Bool # isSuffixOf :: CharString -> CharString -> Bool # isInfixOf :: CharString -> CharString -> Bool # stripPrefix :: CharString -> CharString -> Maybe CharString # stripSuffix :: CharString -> CharString -> Maybe CharString # elem :: Char -> CharString -> Bool # notElem :: Char -> CharString -> Bool # find :: (Char -> Bool) -> CharString -> Maybe Char # filter :: (Char -> Bool) -> CharString -> CharString # partition :: (Char -> Bool) -> CharString -> (CharString, CharString) # index :: CharString -> Int -> Char # elemIndex :: Char -> CharString -> Maybe Int # elemIndices :: (Eq Char, ListLike result Int) => Char -> CharString -> result # findIndex :: (Char -> Bool) -> CharString -> Maybe Int # findIndices :: ListLike result Int => (Char -> Bool) -> CharString -> result # sequence :: (Monad m, ListLike fullinp (m Char)) => fullinp -> m CharString # mapM :: (Monad m, ListLike full' item') => (Char -> m item') -> CharString -> m full' # rigidMapM :: Monad m => (Char -> m Char) -> CharString -> m CharString # nub :: CharString -> CharString # delete :: Char -> CharString -> CharString # deleteFirsts :: CharString -> CharString -> CharString # union :: CharString -> CharString -> CharString # intersect :: CharString -> CharString -> CharString # sort :: CharString -> CharString # insert :: Char -> CharString -> CharString # toList :: CharString -> [Char] # fromList :: [Char] -> CharString # fromListLike :: ListLike full' Char => CharString -> full' # nubBy :: (Char -> Char -> Bool) -> CharString -> CharString # deleteBy :: (Char -> Char -> Bool) -> Char -> CharString -> CharString # deleteFirstsBy :: (Char -> Char -> Bool) -> CharString -> CharString -> CharString # unionBy :: (Char -> Char -> Bool) -> CharString -> CharString -> CharString # intersectBy :: (Char -> Char -> Bool) -> CharString -> CharString -> CharString # groupBy :: (ListLike full' CharString, Eq Char) => (Char -> Char -> Bool) -> CharString -> full' # sortBy :: (Char -> Char -> Ordering) -> CharString -> CharString # insertBy :: (Char -> Char -> Ordering) -> Char -> CharString -> CharString # genericLength :: Num a => CharString -> a # genericTake :: Integral a => a -> CharString -> CharString # genericDrop :: Integral a => a -> CharString -> CharString # genericSplitAt :: Integral a => a -> CharString -> (CharString, CharString) # genericReplicate :: Integral a => a -> Char -> CharString #
ListLike Chars Char # |
Methods empty :: Chars # singleton :: Char -> Chars # cons :: Char -> Chars -> Chars # snoc :: Chars -> Char -> Chars # append :: Chars -> Chars -> Chars # head :: Chars -> Char # uncons :: Chars -> Maybe (Char, Chars) # last :: Chars -> Char # tail :: Chars -> Chars # init :: Chars -> Chars # null :: Chars -> Bool # length :: Chars -> Int # map :: ListLike full' item' => (Char -> item') -> Chars -> full' # rigidMap :: (Char -> Char) -> Chars -> Chars # reverse :: Chars -> Chars # intersperse :: Char -> Chars -> Chars # concat :: (ListLike full' Chars, Monoid Chars) => full' -> Chars # concatMap :: ListLike full' item' => (Char -> full') -> Chars -> full' # rigidConcatMap :: (Char -> Chars) -> Chars -> Chars # any :: (Char -> Bool) -> Chars -> Bool # all :: (Char -> Bool) -> Chars -> Bool # maximum :: Chars -> Char # minimum :: Chars -> Char # replicate :: Int -> Char -> Chars # take :: Int -> Chars -> Chars # drop :: Int -> Chars -> Chars # splitAt :: Int -> Chars -> (Chars, Chars) # takeWhile :: (Char -> Bool) -> Chars -> Chars # dropWhile :: (Char -> Bool) -> Chars -> Chars # dropWhileEnd :: (Char -> Bool) -> Chars -> Chars # span :: (Char -> Bool) -> Chars -> (Chars, Chars) # break :: (Char -> Bool) -> Chars -> (Chars, Chars) # group :: (ListLike full' Chars, Eq Char) => Chars -> full' # inits :: ListLike full' Chars => Chars -> full' # tails :: ListLike full' Chars => Chars -> full' # isPrefixOf :: Chars -> Chars -> Bool # isSuffixOf :: Chars -> Chars -> Bool # isInfixOf :: Chars -> Chars -> Bool # stripPrefix :: Chars -> Chars -> Maybe Chars # stripSuffix :: Chars -> Chars -> Maybe Chars # elem :: Char -> Chars -> Bool # notElem :: Char -> Chars -> Bool # find :: (Char -> Bool) -> Chars -> Maybe Char # filter :: (Char -> Bool) -> Chars -> Chars # partition :: (Char -> Bool) -> Chars -> (Chars, Chars) # index :: Chars -> Int -> Char # elemIndex :: Char -> Chars -> Maybe Int # elemIndices :: (Eq Char, ListLike result Int) => Char -> Chars -> result # findIndex :: (Char -> Bool) -> Chars -> Maybe Int # findIndices :: ListLike result Int => (Char -> Bool) -> Chars -> result # sequence :: (Monad m, ListLike fullinp (m Char)) => fullinp -> m Chars # mapM :: (Monad m, ListLike full' item') => (Char -> m item') -> Chars -> m full' # rigidMapM :: Monad m => (Char -> m Char) -> Chars -> m Chars # nub :: Chars -> Chars # delete :: Char -> Chars -> Chars # deleteFirsts :: Chars -> Chars -> Chars # union :: Chars -> Chars -> Chars # intersect :: Chars -> Chars -> Chars # sort :: Chars -> Chars # insert :: Char -> Chars -> Chars # toList :: Chars -> [Char] # fromList :: [Char] -> Chars # fromListLike :: ListLike full' Char => Chars -> full' # nubBy :: (Char -> Char -> Bool) -> Chars -> Chars # deleteBy :: (Char -> Char -> Bool) -> Char -> Chars -> Chars # deleteFirstsBy :: (Char -> Char -> Bool) -> Chars -> Chars -> Chars # unionBy :: (Char -> Char -> Bool) -> Chars -> Chars -> Chars # intersectBy :: (Char -> Char -> Bool) -> Chars -> Chars -> Chars # groupBy :: (ListLike full' Chars, Eq Char) => (Char -> Char -> Bool) -> Chars -> full' # sortBy :: (Char -> Char -> Ordering) -> Chars -> Chars # insertBy :: (Char -> Char -> Ordering) -> Char -> Chars -> Chars # genericLength :: Num a => Chars -> a # genericTake :: Integral a => a -> Chars -> Chars # genericDrop :: Integral a => a -> Chars -> Chars # genericSplitAt :: Integral a => a -> Chars -> (Chars, Chars) # genericReplicate :: Integral a => a -> Char -> Chars #
ListLike [a] a # |
Methods empty :: [a] # singleton :: a -> [a] # cons :: a -> [a] -> [a] # snoc :: [a] -> a -> [a] # append :: [a] -> [a] -> [a] # head :: [a] -> a # uncons :: [a] -> Maybe (a, [a]) # last :: [a] -> a # tail :: [a] -> [a] # init :: [a] -> [a] # null :: [a] -> Bool # length :: [a] -> Int # map :: ListLike full' item' => (a -> item') -> [a] -> full' # rigidMap :: (a -> a) -> [a] -> [a] # reverse :: [a] -> [a] # intersperse :: a -> [a] -> [a] # concat :: (ListLike full' [a], Monoid [a]) => full' -> [a] # concatMap :: ListLike full' item' => (a -> full') -> [a] -> full' # rigidConcatMap :: (a -> [a]) -> [a] -> [a] # any :: (a -> Bool) -> [a] -> Bool # all :: (a -> Bool) -> [a] -> Bool # maximum :: [a] -> a # minimum :: [a] -> a # replicate :: Int -> a -> [a] # take :: Int -> [a] -> [a] # drop :: Int -> [a] -> [a] # splitAt :: Int -> [a] -> ([a], [a]) # takeWhile :: (a -> Bool) -> [a] -> [a] # dropWhile :: (a -> Bool) -> [a] -> [a] # dropWhileEnd :: (a -> Bool) -> [a] -> [a] # span :: (a -> Bool) -> [a] -> ([a], [a]) # break :: (a -> Bool) -> [a] -> ([a], [a]) # group :: (ListLike full' [a], Eq a) => [a] -> full' # inits :: ListLike full' [a] => [a] -> full' # tails :: ListLike full' [a] => [a] -> full' # isPrefixOf :: [a] -> [a] -> Bool # isSuffixOf :: [a] -> [a] -> Bool # isInfixOf :: [a] -> [a] -> Bool # stripPrefix :: [a] -> [a] -> Maybe [a] # stripSuffix :: [a] -> [a] -> Maybe [a] # elem :: a -> [a] -> Bool # notElem :: a -> [a] -> Bool # find :: (a -> Bool) -> [a] -> Maybe a # filter :: (a -> Bool) -> [a] -> [a] # partition :: (a -> Bool) -> [a] -> ([a], [a]) # index :: [a] -> Int -> a # elemIndex :: a -> [a] -> Maybe Int # elemIndices :: (Eq a, ListLike result Int) => a -> [a] -> result # findIndex :: (a -> Bool) -> [a] -> Maybe Int # findIndices :: ListLike result Int => (a -> Bool) -> [a] -> result # sequence :: (Monad m, ListLike fullinp (m a)) => fullinp -> m [a] # mapM :: (Monad m, ListLike full' item') => (a -> m item') -> [a] -> m full' # rigidMapM :: Monad m => (a -> m a) -> [a] -> m [a] # nub :: [a] -> [a] # delete :: a -> [a] -> [a] # deleteFirsts :: [a] -> [a] -> [a] # union :: [a] -> [a] -> [a] # intersect :: [a] -> [a] -> [a] # sort :: [a] -> [a] # insert :: a -> [a] -> [a] # toList :: [a] -> [a] # fromList :: [a] -> [a] # fromListLike :: ListLike full' a => [a] -> full' # nubBy :: (a -> a -> Bool) -> [a] -> [a] # deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a] # deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] # unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] # intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a] # groupBy :: (ListLike full' [a], Eq a) => (a -> a -> Bool) -> [a] -> full' # sortBy :: (a -> a -> Ordering) -> [a] -> [a] # insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a] # genericLength :: Num a => [a] -> a # genericTake :: Integral a => a -> [a] -> [a] # genericDrop :: Integral a => a -> [a] -> [a] # genericSplitAt :: Integral a => a -> [a] -> ([a], [a]) # genericReplicate :: Integral a => a -> a -> [a] #

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

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 #

An infinite list of repeated calls of the function to args

repeat :: item -> full #

An infinite list where each element is the same

cycle :: full -> full #

Converts a finite list into a circular one

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

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 #

Takes two lists and combines them with a custom combining function

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

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