Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Gather Drasil's utility functions and re-export for easy use.
Synopsis
- blank :: Doc
- indent :: Doc -> Doc
- indentList :: [Doc] -> Doc
- filterEmpty :: [Doc] -> [Doc]
- listToDoc :: [String] -> Doc
- type Separator = Doc
- contSep :: Separator
- capitalize :: String -> String
- stringList :: [String] -> String
- atLeast2 :: [a] -> Bool
- replaceAll :: Eq a => [a] -> a -> [a] -> [a]
- subsetOf :: Eq a => [a] -> [a] -> Bool
- nubSort :: Ord a => [a] -> [a]
- weave :: [[a]] -> [a]
- foldle :: (a -> a -> a) -> (a -> a -> a) -> a -> [a] -> a
- foldle1 :: (a -> a -> a) -> (a -> a -> a) -> [a] -> a
- toColumn :: [a] -> [[a]]
- invert :: Ord v => Map k [v] -> Map v [k]
- toPlainName :: String -> String
Documents
From Utils.Drasil.Document.
indentList :: [Doc] -> Doc Source #
Indents a list of Docs and combines into one Doc.
Language
From Utils.Drasil.English.
capitalize :: String -> String Source #
String capitalization.
stringList :: [String] -> String Source #
Comma separated list with "and" before final item.
Lists
From Utils.Drasil.Lists. General functions involving lists.
replaceAll :: Eq a => [a] -> a -> [a] -> [a] Source #
Replaces all elements of a target list that belong to a provided "bad" input list.
foldle :: (a -> a -> a) -> (a -> a -> a) -> a -> [a] -> a Source #
Fold helper function that applies f to all but the last element, applies g to last element and the accumulator.
foldle1 :: (a -> a -> a) -> (a -> a -> a) -> [a] -> a Source #
Fold helper function that applies f to all but last element, applies g to last element and accumulator without starting value, does not work for empty list.
Maps
Strings
toPlainName :: String -> String Source #
Replace occurences of special characters (",~`-=!
#$%^&*+[]\;'/|"<>? ")
with underscores (
"_"@).
TODO: This can probably become a bit more comprehensive, anything other than a-z, A-Z, or 0-9 could probably be replaced.