|
|
|
|
|
Description |
Utility functions.
|
|
Synopsis |
|
|
|
|
Debug functions
|
|
debug :: Show a => a -> a | Source |
|
To be used only for debugging, breaks referential integrity.
|
|
debugFn :: Show b => (a -> b) -> a -> a | Source |
|
Displays a modified form of the second parameter before returning
it.
|
|
debugXy :: Show a => a -> b -> b | Source |
|
Show the first parameter before returning the second one.
|
|
Miscellaneous
|
|
applyIf :: Bool -> (a -> a) -> a -> a | Source |
|
Apply the function if condition holds, otherwise use default value.
|
|
commaJoin :: [String] -> String | Source |
|
Comma-join a string list.
|
|
sepSplit :: Eq a => a -> [a] -> [[a]] | Source |
|
Split a list on a separator and return an array.
|
|
plural :: Int -> String -> String -> String | Source |
|
Simple pluralize helper
|
|
ensureQuoted :: String -> String | Source |
|
Ensure a value is quoted if needed.
|
|
Mathematical functions
|
|
stdDev :: [Double] -> Double | Source |
|
Standard deviation function.
|
|
Logical functions
|
|
|
:: | | => Bool | "then" result
| -> a | "else" result
| -> a | "then" or else result depending on the condition
| -> a | | "if" as a function, rather than as syntactic sugar.
|
|
|
Parsing utility functions
|
|
parseChoices :: (Monad m, Read a) => String -> String -> [(a, String)] -> m a | Source |
|
Parse results from readsPrec.
|
|
tryRead :: (Monad m, Read a) => String -> String -> m a | Source |
|
Safe read function returning data encapsulated in a Result.
|
|
formatTable :: [[String]] -> [Bool] -> [[String]] | Source |
|
Format a table of strings to maintain consistent length.
|
|
printTable :: String -> [String] -> [[String]] -> [Bool] -> String | Source |
|
Constructs a printable table from given header and rows
|
|
parseUnitValue :: Monad m => String -> m Rational | Source |
|
Converts a unit (e.g. m or GB) into a scaling factor.
|
|
parseUnit :: (Monad m, Integral a, Read a) => String -> m a | Source |
|
Tries to extract number and scale from the given string.
Input must be in the format NUMBER+ SPACE* [UNIT]. If no unit is
specified, it defaults to MiB. Return value is always an integral
value in MiB.
|
|
|
Unwraps a Result, exiting the program if it is a Bad value,
otherwise returning the actual contained value.
|
|
exitErr :: String -> IO a | Source |
|
Exits immediately with an error message.
|
|
exitWhen :: Bool -> String -> IO () | Source |
|
Exits with an error message if the given boolean condition if true.
|
|
exitUnless :: Bool -> String -> IO () | Source |
|
Exits with an error message unless the given boolean condition
if true, the opposite of exitWhen.
|
|
Produced by Haddock version 2.6.0 |