| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell98 |
Data.List.Compat
- dropWhileEnd :: (a -> Bool) -> [a] -> [a]
- isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
- sortOn :: Ord b => (a -> b) -> [a] -> [a]
- uncons :: [a] -> Maybe (a, [a])
Documentation
dropWhileEnd :: (a -> Bool) -> [a] -> [a]
The dropWhileEnd function drops the largest suffix of a list
in which the given predicate holds for all elements. For example:
dropWhileEnd isSpace "foo\n" == "foo"
dropWhileEnd isSpace "foo bar" == "foo bar"
dropWhileEnd isSpace ("foo\n" ++ undefined) == "foo" ++ undefinedSince: 4.5.0.0
isSubsequenceOf :: Eq a => [a] -> [a] -> Bool Source
The isSubsequenceOf function takes two lists and returns True if the
first list is a subsequence of the second list.
is equivalent to isSubsequenceOf x y.elem x (subsequences y)
Since: 4.8.0.0
Examples
>>>isSubsequenceOf "GHC" "The Glorious Haskell Compiler"True>>>isSubsequenceOf ['a','d'..'z'] ['a'..'z']True>>>isSubsequenceOf [1..10] [10,9..0]False
sortOn :: Ord b => (a -> b) -> [a] -> [a] Source
Sort a list by comparing the results of a key function applied to each
element. sortOn f is equivalent to sortBy . comparing f, but has the
performance advantage of only evaluating f once for each element in the
input list. This is called the decorate-sort-undecorate paradigm, or
Schwartzian transform.
Since: 4.8.0.0