Safe Haskell | None |
---|

- isPrefixOf :: Eq a => [a] -> [a] -> Bool
- isSuffixOf :: Eq a => [a] -> [a] -> Bool
- stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]
- stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]
- splitWhen :: (a -> Bool) -> [a] -> [[a]]
- splitOn :: Eq a => a -> [a] -> [[a]]
- partition :: (a -> Bool) -> [a] -> ([a], [a])
- inits :: [a] -> [[a]]
- groupSortBy :: (a -> a -> Ordering) -> [a] -> [[a]]
- groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
- findM :: (a -> Fay (Maybe b)) -> [a] -> Fay (Maybe b)

# Documentation

isPrefixOf :: Eq a => [a] -> [a] -> BoolSource

The `isPrefixOf`

function takes two lists and returns `True`

iff the first list is a prefix of the second.

isSuffixOf :: Eq a => [a] -> [a] -> BoolSource

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)

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