Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Utils.Drasil
Description
Gather Drasil's utility functions and re-export for easy use. For now, does not include combinators (Sentence.hs, NounPhrase.hs, Concepts.hs)
Synopsis
- blank :: Doc
- indent :: Doc -> Doc
- indentList :: [Doc] -> Doc
- capitalize :: String -> String
- stringList :: [String] -> String
- 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
- 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.
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.