Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- multimap :: Foldable f => Ord k => f (k, v) -> Map k [v]
- groupBy :: (Foldable f, Ord k) => (v -> k) -> f v -> Map k [v]
- groupMap :: (Foldable f, Eq k) => (a -> (k, b)) -> f a -> [(k, [b])]
- uniqueBy :: (Foldable f, Ord b) => (a -> b) -> f a -> [a]
- nubOrdOn :: (Foldable f, Ord b) => (a -> b) -> f a -> [a]
- uniqueBy' :: (Foldable f, Ord b) => (a -> b) -> f a -> [a]
- safeHead :: Foldable f => f a -> Maybe a
- validate :: (Semigroup e, Foldable f) => (a -> Either e b) -> f a -> Either e [b]
- intercalateMapWith :: (a -> a -> b) -> (a -> b) -> [a] -> [b]
- quenchRuns :: Eq a => a -> a -> [a] -> [a]
- splitOnLongestCommonPrefix :: Eq a => [a] -> [a] -> ([a], [a], [a])
Documentation
groupMap :: (Foldable f, Eq k) => (a -> (k, b)) -> f a -> [(k, [b])] Source #
group _consecutive_ elements by a key. e.g. >>> groupMap (n -> (odd n, show n)) [1, 3, 4, 6, 7] [(True,["1","3"]),(False,["4","6"]),(True,["7"])]
intercalateMapWith :: (a -> a -> b) -> (a -> b) -> [a] -> [b] Source #
quenchRuns :: Eq a => a -> a -> [a] -> [a] Source #
splitOnLongestCommonPrefix :: Eq a => [a] -> [a] -> ([a], [a], [a]) Source #
Finds the longest shared path prefix of two paths. Returns (shared prefix, path to first location from shared prefix, path to second location from shared prefix)
>>>
splitOnLongestCommonPrefix ["a", "b", "x"] ["a", "b", "c"]
(["a","b"],["x"],["c"])
>>>
splitOnLongestCommonPrefix [] ["a", "b", "c"]
([],[],["a","b","c"])