Extra-1.29: A grab bag of modules.Source codeContentsIndex
Extra.List
Synopsis
consperse :: [a] -> [[a]] -> [a]
surround :: [a] -> [a] -> [[a]] -> [a]
changePrefix :: Eq a => [a] -> [a] -> [a] -> Maybe [a]
dropPrefix :: Eq a => [a] -> [a] -> Maybe [a]
cartesianProduct :: [[a]] -> [[a]]
wordsBy :: Eq a => (a -> Bool) -> [a] -> [[a]]
empty :: b -> ([a] -> b) -> [a] -> b
sortByMapped :: (a -> b) -> (b -> b -> Ordering) -> [a] -> [a]
sortByMappedM :: (a -> IO b) -> (b -> b -> Ordering) -> [a] -> IO [a]
partitionM :: Monad m => (a -> m Bool) -> [a] -> m ([a], [a])
listIntersection :: Eq a => [[a]] -> [a]
isSublistOf :: Eq a => [a] -> [a] -> Maybe Int
Documentation
consperse :: [a] -> [[a]] -> [a]Source
The mighty consperse function - e.g. consperse , [a, b] -> a,b consperse = MissingH.List.join
surround :: [a] -> [a] -> [[a]] -> [a]Source
surround each element of a list - e.g. surround ( ) [a, b] -> [(a)(b)]
changePrefix :: Eq a => [a] -> [a] -> [a] -> Maybe [a]Source
Replace the prefix of s, return Nothing if it doesn't match.
dropPrefix :: Eq a => [a] -> [a] -> Maybe [a]Source
Remove a prefix of s, return nothing if it doesn't match.
cartesianProduct :: [[a]] -> [[a]]Source
cartesianProduct [[1,2,3], [4,5],[6]] -> [[1,4,6],[1,5,6],[2,4,6],[2,5,6],[3,4,6],[3,5,6]]
wordsBy :: Eq a => (a -> Bool) -> [a] -> [[a]]Source
FIXME: implement for a string
empty :: b -> ([a] -> b) -> [a] -> bSource
Like maybe, but with empty vs. non-empty list
sortByMapped :: (a -> b) -> (b -> b -> Ordering) -> [a] -> [a]Source
Sort a list using the compare function on the list elements mapped over f. This is like sortBy ( a b -> compare (f a) (f b)) except that f is applied O(n) times instead of O(n log n)
sortByMappedM :: (a -> IO b) -> (b -> b -> Ordering) -> [a] -> IO [a]Source
Monadic version of sortByMapped
partitionM :: Monad m => (a -> m Bool) -> [a] -> m ([a], [a])Source
listIntersection :: Eq a => [[a]] -> [a]Source
isSublistOf :: Eq a => [a] -> [a] -> Maybe IntSource
Produced by Haddock version 2.6.0