Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Handy utilities
- usort :: Ord a => [a] -> [a]
- usortOn :: Ord b => (a -> b) -> [a] -> [a]
- unionOn :: Ord b => (a -> b) -> [a] -> [a] -> [a]
- duplicates :: Ord a => [a] -> [a]
- data Component a
- flattenComponent :: Component a -> [a]
- components :: Ord name => (thing -> name) -> (thing -> [name]) -> [thing] -> [Component thing]
- lookupComponent :: Eq thing => thing -> [Component thing] -> Maybe (Component thing)
- sortThings :: Ord name => (thing -> name) -> (thing -> [name]) -> [thing] -> [[thing]]
- recursive :: Ord name => (thing -> name) -> (thing -> [name]) -> [thing] -> [name]
- flagify :: String -> String
- flagifyShow :: Show a => a -> String
- maximumOn :: forall f a b. (Foldable f, Ord b) => (a -> b) -> f a -> b
- withPrevious :: [a] -> [(a, [a])]
- cursor :: [a] -> [([a], a, [a])]
Documentation
usortOn :: Ord b => (a -> b) -> [a] -> [a] Source
Sort and remove duplicates wrt some custom ordering
duplicates :: Ord a => [a] -> [a] Source
Returns the duplicates in a list
flattenComponent :: Component a -> [a] Source
components :: Ord name => (thing -> name) -> (thing -> [name]) -> [thing] -> [Component thing] Source
Strongly connected components
sortThings :: Ord name => (thing -> name) -> (thing -> [name]) -> [thing] -> [[thing]] Source
Sort things in topologically in strongly connected components
flagify :: String -> String Source
Makes a nice flag from a constructor string
> flagify "PrintPolyFOL" "print-poly-fol"
flagifyShow :: Show a => a -> String Source
Makes a flag from something Show
-able
maximumOn :: forall f a b. (Foldable f, Ord b) => (a -> b) -> f a -> b Source
Calculates the maximum value of a foldable value.
withPrevious :: [a] -> [(a, [a])] Source
Pair up a list with its previous elements
withPrevious "abc" = [('a',""),('b',"a"),('c',"ab")]