Safe Haskell | Safe-Inferred |
---|

- 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

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]]

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