| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Utils.Drasil
Description
Re-exports all utilities.
Synopsis
- createDirIfMissing :: Bool -> FilePath -> IO ()
- blank :: Doc
- indent :: Doc -> Doc
- indentList :: [Doc] -> Doc
- contSep :: Separator
- filterEmpty :: [Doc] -> [Doc]
- listToDoc :: [String] -> Doc
- type Separator = Doc
- capitalize :: String -> String
- stringList :: [String] -> String
- createFile :: FilePath -> String -> IO ()
- data RelativeFile
- relativeFile :: String -> RelativeFile
- relFileToStr :: RelativeFile -> 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
- toColumn :: [a] -> [[a]]
- mkTable :: [a -> b] -> [a] -> [[b]]
- toPlainName :: String -> String
- repUnd :: String -> String
- class HasPathAndDoc a b | a -> b where
Documentation
createDirIfMissing :: Bool -> FilePath -> IO () Source #
Creates a directory if it does not already exist (optionally with all missing parent directories).
Implementation uses doesPathExist to check if the directory exists rather than createDirectoryIfMissing True, which would create the directory regardless of whether it exists or not, potentially leading to an error that appears in `make debug` logs.
indentList :: [Doc] -> Doc Source #
Indents a list of Docs and combines into one Doc.
capitalize :: String -> String Source #
String capitalization.
stringList :: [String] -> String Source #
Comma separated list with "and" before final item.
data RelativeFile Source #
A valid, relative file path with an extension in canonical form.
Instances
| Eq RelativeFile Source # | |
Defined in Utils.Drasil.FilePath | |
relativeFile :: String -> RelativeFile Source #
Create a RelativeFile given a String that must be in canonical form, be
a valid file path, contain a file extension, and be relative (not absolute);
otherwise, an error is raised.
relFileToStr :: RelativeFile -> String Source #
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 that applies f to all but the last element and g to the last
element and the accumulator given an initial value, z.
foldle1 :: (a -> a -> a) -> (a -> a -> a) -> [a] -> a Source #
Fold that applies f to all but last element and g to the last element
and accumulator, without a starting value. Does not work on empty lists.
mkTable :: [a -> b] -> [a] -> [[b]] Source #
Create a table body (not including header row) by applying the given functions to the column elements of the table rows (in order). The first argument is a list of functions to be applied (one per column). This essentially creates the rows. The second argument is a list of elements apply the functions to.
For example, mkTable [id, *5] [1,2,3] should produce a table:
| 1 | 5 | | 2 | 10 | | 3 | 15 |
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.
class HasPathAndDoc a b | a -> b where Source #
Instances
| HasPathAndDoc FileAndContents Doc Source # | |
Defined in Utils.Drasil.FileData | |