ghc-9.6.0.20230128: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.JS.Ppr

Description

Pretty-printing JavaScript

Synopsis

Documentation

renderJs :: (JsToDoc a, JMacro a) => a -> Doc Source #

Render a syntax tree as a pretty-printable document (simply showing the resultant doc produces a nice, well formatted String).

renderJs' :: (JsToDoc a, JMacro a) => RenderJs -> a -> Doc Source #

renderPrefixJs :: (JsToDoc a, JMacro a) => FastString -> a -> Doc Source #

Render a syntax tree as a pretty-printable document, using a given prefix to all generated names. Use this with distinct prefixes to ensure distinct generated names between independent calls to render(Prefix)Js.

class JsToDoc a where Source #

Methods

jsToDocR :: RenderJs -> a -> Doc Source #

Instances

Instances details
JsToDoc Ident Source # 
Instance details

Defined in GHC.JS.Ppr

Methods

jsToDocR :: RenderJs -> Ident -> Doc Source #

JsToDoc JExpr Source # 
Instance details

Defined in GHC.JS.Ppr

Methods

jsToDocR :: RenderJs -> JExpr -> Doc Source #

JsToDoc JStat Source # 
Instance details

Defined in GHC.JS.Ppr

Methods

jsToDocR :: RenderJs -> JStat -> Doc Source #

JsToDoc JVal Source # 
Instance details

Defined in GHC.JS.Ppr

Methods

jsToDocR :: RenderJs -> JVal -> Doc Source #

JsToDoc [JExpr] Source # 
Instance details

Defined in GHC.JS.Ppr

Methods

jsToDocR :: RenderJs -> [JExpr] -> Doc Source #

JsToDoc [JStat] Source # 
Instance details

Defined in GHC.JS.Ppr

Methods

jsToDocR :: RenderJs -> [JStat] -> Doc Source #

data RenderJs Source #

Constructors

RenderJs 

Fields

jsToDoc :: JsToDoc a => a -> Doc Source #

hangBrace :: Doc -> Doc -> Doc Source #

Hang with braces:

hdr { body }

Orphan instances

Outputable JExpr Source # 
Instance details

Methods

ppr :: JExpr -> SDoc Source #

Outputable JVal Source # 
Instance details

Methods

ppr :: JVal -> SDoc Source #