Safe Haskell | None |
---|---|
Language | Haskell2010 |
Pretty-printing JavaScript.
- class Pretty a where
- prettyPrint :: a -> Doc
- javaScript :: JavaScript a -> Doc
- renderStatements :: [Statement a] -> String
- renderExpression :: Expression a -> String
- class PP a where
- unsafeInExprStmt :: Expression a -> Bool
Documentation
A class of pretty-printable ECMAScript AST nodes. Will
pretty-print correct JavaScript given that the isValid
predicate
holds for the AST.
prettyPrint :: a -> Doc Source
javaScript :: JavaScript a -> Doc Source
Deprecated: These interfaces are outdated and would be removed/hidden in version 1.0. Use the Pretty class instead.
DEPRECATED: Use prettyPrint
instead! Renders a JavaScript
program as a document, the show instance of Doc
will pretty-print
it automatically
renderStatements :: [Statement a] -> String Source
Deprecated: These interfaces are outdated and would be removed/hidden in version 1.0. Use the Pretty class instead.
DEPRECATED: Use prettyPrint
instead! Renders a list of
statements as a String
renderExpression :: Expression a -> String Source
Deprecated: These interfaces are outdated and would be removed/hidden in version 1.0. Use the Pretty class instead.
DEPRECATED: Use prettyPrint
instead! Renders a list of
statements as a String
Deprecated: These interfaces are outdated and would be removed/hidden in version 1.0. Use the Pretty class instead.
unsafeInExprStmt :: Expression a -> Bool Source
A predicate to tell if the expression --when pretty-printed-- will begin with "function" or '{' and be thus unsafe to use in an expression statement without wrapping it in '()'.