fay-base-0.20.0.0: The base package for Fay.

Safe HaskellNone
LanguageHaskell98

Data.List

Synopsis

Documentation

isPrefixOf :: Eq a => [a] -> [a] -> Bool Source

The isPrefixOf function takes two lists and returns True iff the first list is a prefix of the second.

isSuffixOf :: Eq a => [a] -> [a] -> Bool Source

The isSuffixOf function takes two lists and returns True iff the first list is a suffix of the second. Both lists must be finite.

stripPrefix :: Eq a => [a] -> [a] -> Maybe [a] Source

The stripPrefix function drops the given prefix from a list. It returns Nothing if the list did not start with the prefix given, or Just the list after the prefix, if it does.

stripPrefix "foo" "foobar" == Just "bar"
stripPrefix "foo" "foo" == Just ""
stripPrefix "foo" "barfoo" == Nothing
stripPrefix "foo" "barfoobaz" == Nothing

stripSuffix :: Eq a => [a] -> [a] -> Maybe [a] Source

Like stripPrefix, but drops the given suffix from the end.

splitWhen :: (a -> Bool) -> [a] -> [[a]] Source

Split lists at delimiter specified by a condition Drops empty groups (similar to words)

splitOn :: Eq a => a -> [a] -> [[a]] Source

Split lists at the specified delimiter Drops empty groups (similar to words)

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

The partition function takes a predicate a list and returns the pair of lists of elements which do and do not satisfy the predicate, respectively; i.e.,

partition p xs == (filter p xs, filter (not . p) xs)

inits :: [a] -> [[a]] Source

The inits function returns all initial segments of the argument, shortest first. For example,

inits "abc" == ["","a","ab","abc"]

Note that inits has the following strictness property: inits _|_ = [] : _|_

groupSortBy :: (a -> a -> Ordering) -> [a] -> [[a]] Source

groupBy :: (a -> a -> Bool) -> [a] -> [[a]] Source

Classic group by.

findM :: (a -> Fay (Maybe b)) -> [a] -> Fay (Maybe b) Source

Belongs in Control.Monad, right?