Utitlity functions on lists.
- type Prefix a = [a]
- type Suffix a = [a]
- maybePrefixMatch :: Eq a => Prefix a -> [a] -> Maybe (Suffix a)
- wordsBy :: (a -> Bool) -> [a] -> [[a]]
- chop :: Int -> [a] -> [[a]]
- holes :: [a] -> [(a, [a])]
- distinct :: Eq a => [a] -> Bool
- allEqual :: Eq a => [a] -> Bool
- groupBy' :: (a -> a -> Bool) -> [a] -> [[a]]
- prop_groupBy' :: (Bool -> Bool -> Bool) -> [Bool] -> Property
- groupOn :: Ord b => (a -> b) -> [a] -> [[a]]
- extractNthElement :: Integral i => i -> [a] -> (a, [a])
- prop_extractNthElement :: Integer -> [Integer] -> Property
- tests :: IO Bool
Check if a list has a given prefix. If so, return the list minus the prefix.
Split a list into sublists. Generalisation of the prelude function
words xs == wordsBy isSpace xs
Check whether all elements in a list are distinct from each
other. Assumes that the
Eq instance stands for an equivalence
Checks if all the elements in the list are equal. Assumes that
Eq instance stands for an equivalence relation.
A variant of
groupBy which applies the predicate to consecutive
extractNthElement n xs
n-th element in
(counting from 0), plus the remaining elements (preserving order).