Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Documentation
The class of types that can be pretty-printed. (Unfortunately this is not very useful, because and Expr can be pretty Haskell or pretty Python or pretty Scheme, leading to overlapping instance declarations.)
pretty x is a pretty String representation of x. prettyList prefix infix postfix xs is a pretty String representation of the list xs, with prefix, infix, and postfix specifying the punctuation. For example, if (pretty x) => "x", then prettyList "[" ", " "]" [x, x, x] => "[x, x, x]".
Minimal complete implementation: define pretty.
indentLine :: Int -> String -> String Source
Indent a single line n spaces.
sepLines :: [String] -> String Source
sepLines is like unlines, but omits the n at the end of the last line.
sepLines2 :: [String] -> String Source
sepLines2 is like sepLines, but adds an extra n between each pair of lines so they are "double spaced."
sepCommaSp :: [String] -> String Source
Separate strings by commas and spaces (", ")