Safe Haskell | None |
---|
Pretty printing.
- class (Annotated ast, Typeable1 ast) => Pretty ast
- pretty :: Pretty ast => ast NodeInfo -> Printer ()
- prettyNoExt :: Pretty ast => ast NodeInfo -> Printer ()
- write :: Builder -> Printer ()
- newline :: Printer ()
- space :: Printer ()
- comma :: Printer ()
- int :: Integral n => n -> Printer ()
- string :: String -> Printer ()
- maybeCtx :: Maybe (Context NodeInfo) -> Printer ()
- printComment :: Comment -> Printer ()
- inter :: Printer () -> [Printer ()] -> Printer ()
- spaced :: [Printer ()] -> Printer ()
- lined :: [Printer ()] -> Printer ()
- prefixedLined :: Char -> [Printer ()] -> Printer ()
- commas :: [Printer ()] -> Printer ()
- parens :: Printer a -> Printer a
- brackets :: Printer a -> Printer a
- braces :: Printer a -> Printer a
- indented :: Int64 -> Printer a -> Printer a
- column :: Int64 -> Printer a -> Printer a
- depend :: Printer () -> Printer b -> Printer b
- swing :: Printer () -> Printer b -> Printer b
- getIndentSpaces :: Printer Int64
- getColumnLimit :: Printer Int64
- nullBinds :: Binds NodeInfo -> Bool
- sandbox :: MonadState s m => m a -> m s
- pretty' :: (Pretty (ast SrcSpanInfo), Functor ast) => ast NodeInfo -> Printer ()
Printing
class (Annotated ast, Typeable1 ast) => Pretty ast Source
Pretty printing class.
prettyNoExt :: Pretty ast => ast NodeInfo -> Printer ()Source
Run the basic printer for the given node without calling an extension hook for this node, but do allow extender hooks in child nodes. Also auto-inserts comments.
Insertion
Common node types
printComment :: Comment -> Printer ()Source
Pretty print a comment.
Interspersing
prefixedLined :: Char -> [Printer ()] -> Printer ()Source
Print all the printers separated newlines and optionally a line prefix.
Wrapping
Indentation
indented :: Int64 -> Printer a -> Printer aSource
Increase indentation level by n spaces for the given printer.
column :: Int64 -> Printer a -> Printer aSource
Set the (newline-) indent level to the given column for the given printer.
depend :: Printer () -> Printer b -> Printer bSource
Make the latter's indentation depend upon the end column of the former.
swing :: Printer () -> Printer b -> Printer bSource
Swing the second printer below and indented with respect to the first.
getIndentSpaces :: Printer Int64Source
Indent spaces, e.g. 2.
getColumnLimit :: Printer Int64Source
Column limit, e.g. 80
Predicates
Sandboxing
sandbox :: MonadState s m => m a -> m sSource
Play with a printer and then restore the state to what it was before.