sifflet-lib-1.1: Library of modules shared by sifflet and its tests and its exporters.




class Pretty a whereSource

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.


pretty :: a -> StringSource

prettyList :: String -> String -> String -> [a] -> StringSource

indentLine :: Int -> String -> StringSource

Indent a single line n spaces.

sepLines :: [String] -> StringSource

sepLines is like unlines, but omits the n at the end of the last line.

sepLines2 :: [String] -> StringSource

sepLines2 is like sepLines, but adds an extra n between each pair of lines so they are double spaced.

sepComma :: [String] -> StringSource

Separate strings by commas and nothing else (,)

sepCommaSp :: [String] -> StringSource

Separate strings by commas and spaces (, )

sepSpace :: [String] -> StringSource

Separate strings by just spaces ( )