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
- labeled :: String -> String -> String
- labeledIndented :: String -> String -> Reader Level String
- type Level = Int
- addLevel :: Reader Level a -> Reader Level a
- indent :: String -> Reader Level String
- commaSeparated :: [String] -> [String]
- indentConcat :: [String] -> Reader Level String
- labeledList :: String -> [String] -> Reader Level String
- escaper :: String -> String
- class RenderableIndented a where
- renderIndented :: a -> Reader Level String
- renderNoIndent :: RenderableIndented a => a -> String
- class Renderable a where
- data CabalVersion = CabalVersion Word Word
- newtype Flags = Flags [Flag]
- renLibrary :: [LibraryField] -> Reader Level String
Documentation
(<+>) :: String -> String -> String Source
Separate two strings with a space, but only if both strings are not empty.
commaSeparated :: [String] -> [String] Source
Adds comma separators to a list.
escaper :: String -> String Source
Renders a string using show
, but only if it is both non-empty
and contains characters that might be problematic. For now,
"might be problematic" simply means any character that is either
above Unicode code point 7F or is not a letter, digit, hyphen,
period, or underscore.
If the string is empty, or if it contains only non-problematic characters, returns the string as-is.
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 :: a -> Reader Level String Source
RenderableIndented FlagOpts | |
RenderableIndented Flag | |
RenderableIndented Error | |
RenderableIndented Cabal | |
RenderableIndented Properties | |
RenderableIndented Section | |
RenderableIndented Benchmark | |
RenderableIndented BenchmarkField | |
RenderableIndented TestSuite | |
RenderableIndented TestSuiteField | |
RenderableIndented Executable | |
RenderableIndented ExecutableField | |
RenderableIndented LibraryField | |
RenderableIndented BuildInfoField | Contains many lists of items. Items that might contain spaces or other troublesome characters are rendered quoted. In particular, this includes filenames. Items that are highly unlikely to contain troublesome characters (such as compiler options) are not quoted. |
RenderableIndented Repository | |
RenderableIndented Flags | |
RenderableIndented a => RenderableIndented (CondBlock a) |
renderNoIndent :: RenderableIndented a => a -> String Source
class Renderable a where Source
Render an item. The rendered text shall contain no newlines.
data CabalVersion Source
renLibrary :: [LibraryField] -> Reader Level String Source