Safe Haskell | Safe |
---|---|
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
- 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.
RenderableIndented FlagOpts Source # | |
RenderableIndented Flag Source # | |
RenderableIndented Error Source # | |
RenderableIndented Cabal Source # | |
RenderableIndented Properties Source # | |
RenderableIndented Section Source # | |
RenderableIndented Benchmark Source # | |
RenderableIndented BenchmarkField Source # | |
RenderableIndented TestSuite Source # | |
RenderableIndented TestSuiteField Source # | |
RenderableIndented Executable Source # | |
RenderableIndented ExecutableField Source # | |
RenderableIndented LibraryField Source # | |
RenderableIndented BuildInfoField Source # | 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 Source # | |
RenderableIndented Flags Source # | |
RenderableIndented a => RenderableIndented (CondBlock a) Source # | |
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 #