tip-lib-0.2.2: tons of inductive problems - support library and tools

Safe HaskellSafe
LanguageHaskell2010

Tip.Utils

Description

Handy utilities

Synopsis

Documentation

usort :: Ord a => [a] -> [a] Source

Sort and remove duplicates

usortOn :: Ord b => (a -> b) -> [a] -> [a] Source

Sort and remove duplicates wrt some custom ordering

unionOn :: Ord b => (a -> b) -> [a] -> [a] -> [a] Source

Union on a predicate

duplicates :: Ord a => [a] -> [a] Source

Returns the duplicates in a list

data Component a Source

Constructors

Rec [a] 
NonRec a 

components :: Ord name => (thing -> name) -> (thing -> [name]) -> [thing] -> [Component thing] Source

Strongly connected components

lookupComponent :: Eq thing => thing -> [Component thing] -> Maybe (Component thing) Source

sortThings :: Ord name => (thing -> name) -> (thing -> [name]) -> [thing] -> [[thing]] Source

Sort things in topologically in strongly connected components

recursive :: Ord name => (thing -> name) -> (thing -> [name]) -> [thing] -> [name] Source

Recursive

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

cursor :: [a] -> [([a], a, [a])] Source

Cursored traversal with previous and next elements of a list