cartel-0.12.0.2: Specify Cabal files in Haskell

Safe HaskellSafe-Inferred
LanguageHaskell2010

Cartel.Render

Description

Reducing a Cartel AST to flat Cabal text; essentially a pretty-printer.

Synopsis

Documentation

(<+>) :: String -> String -> String Source

Separate two strings with a space, but only if both strings are not empty.

vsep :: [String] -> String Source

Concatenate several vertically. Unlike unlines, does not add a newline when an item is null or when the accumulator is null.

indent :: Int -> String -> String Source

Indents a line of text; adds a newline at the end.

indentList Source

Arguments

:: 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.

labeled Source

Arguments

:: Renderable a 
=> Int

Indentation

-> String

Label

-> a

Text

-> String

Result, with a newline. Empty if the text to show is also empty.

labeledList Source

Arguments

:: Renderable a 
=> Int

Indentation

-> String

Label

-> [a]

List

-> String

Result, with newlines. Empty if the list is empty.

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.

Methods

renderIndented :: Int -> a -> String Source