| Safe Haskell | Safe-Inferred |
|---|
Language.Lua.PrettyPrinter
Description
Lua pretty-printer.
- renderPretty :: Float -> Int -> Doc -> SimpleDoc
- displayS :: SimpleDoc -> ShowS
- displayIO :: Handle -> SimpleDoc -> IO ()
- class LPretty a where
- pprint :: a -> Doc
Documentation
renderPretty :: Float -> Int -> Doc -> SimpleDocSource
This is the default pretty printer which is used by show,
putDoc and hPutDoc. (renderPretty ribbonfrac width x) renders
document x with a page width of width and a ribbon width of
(ribbonfrac * width) characters. The ribbon width is the maximal
amount of non-indentation characters on a line. The parameter
ribbonfrac should be between 0.0 and 1.0. If it is lower or
higher, the ribbon width will be 0 or width respectively.
displayS :: SimpleDoc -> ShowSSource
(displayS simpleDoc) takes the output simpleDoc from a
rendering function and transforms it to a ShowS type (for use in
the Show class).
showWidth :: Int -> Doc -> String showWidth w x = displayS (renderPretty 0.4 w x) ""
displayIO :: Handle -> SimpleDoc -> IO ()Source
(displayIO handle simpleDoc) writes simpleDoc to the file
handle handle. This function is used for example by hPutDoc:
hPutDoc handle doc = displayIO handle (renderPretty 0.4 100 doc)
Instances
| LPretty Bool | |
| LPretty [Char] | |
| LPretty (FunArg a) | |
| LPretty (FunCall a) | |
| LPretty (FunBody a) | |
| LPretty (FunDef a) | |
| LPretty (FunName a) | |
| LPretty (Block a) | |
| LPretty (TableField a) | |
| LPretty (Table a) | |
| LPretty (PrefixExp a) | |
| LPretty (Unop a) | |
| LPretty (Binop a) | |
| LPretty (Var a) | |
| LPretty (Exp a) | |
| LPretty (Stat a) | |
| LPretty (Name a) |