Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Reducing a Cartel AST to flat Cabal text; essentially a pretty-printer.
- (<+>) :: String -> String -> String
- vsep :: [String] -> String
- indentAmt :: Int
- indent :: Int -> String -> String
- indentList :: Renderable a => Int -> [a] -> String
- labeled :: Renderable a => Int -> String -> a -> String
- labeledList :: Renderable a => Int -> String -> [a] -> String
- class Renderable a where
- class RenderableIndented a where
- renderIndented :: Int -> a -> String
- newtype Description = Description [String]
- renLibrary :: Int -> [LibraryField] -> String
Documentation
(<+>) :: String -> String -> String Source
Separate two strings with a space, but only if both strings are not empty.
:: Renderable a | |
=> Int | Indentation level. |
-> [a] | |
-> String |
Creates a comma-separated indented representation for a list of items, such as a list of filenames or modules. Each line ends with a newline.
:: Renderable a | |
=> Int | Indentation |
-> String | Label |
-> a | Text |
-> String | Result, with a newline. Empty if the text to show is also empty. |
:: Renderable a | |
=> Int | Indentation |
-> String | Label |
-> [a] | List |
-> String | Result, with newlines. Empty if the list is empty. |
class Renderable a where Source
Render an item. The rendered text shall contain no newlines.
class RenderableIndented a where Source
Render an item. The rendered text must contain a newline at the
end of each line and must end with a newline. The leftmost line of
the rendered text shall be indented by the given number of
indentation levels (the number of spaces in each level is set by
indentAmt
).
If there are no lines to indent, return an empty string.
renderIndented :: Int -> a -> String Source
newtype Description Source
renLibrary :: Int -> [LibraryField] -> String Source