Pretty printing an elm-syntax tree
in a way consistent with elm-format.
Pretty printable intermediate representation.
See toString
Print an Elm.Syntax.File.File
That's all you'll need most of the time.
Sometimes it's useful to print only some part of the syntax, to, say, display only an expression in an article or reformat only the touched declarations on save.
Print an Elm.Syntax.Module.Module
(confusingly, that's their name for only the module X exposing (Y) lines)
Print the stuff after exposing in a module header.
For import exposing: importExposing
Print a single Elm.Syntax.Exposing.TopLevelExpose
Print a set of Elm.Syntax.Import.Imports
Print a single Elm.Syntax.Import.Import
Print the stuff after exposing in an import.
For module header exposing: moduleExposing
Print -- or {- -} comments placed outside of declarations at the top level.
For comments within a declaration: comments
Print -- or {- -} comments placed within a declaration.
For top-level comments: moduleLevelComments
Print a single -- or {- -} comment.
Print a list of Elm.Syntax.Declaration.Declarations
and comments in between
Print an Elm.Syntax.Declaration.Declaration
Print an Elm.Syntax.Type.Type declaration
Print an Elm.Syntax.Signature.Signature
as name : Type
Print an Elm.Syntax.Expression.Function declaration
Print an Elm.Syntax.Infix.Infix declaration
Print a port Elm.Syntax.Declaration.Declaration
Print an Elm.Syntax.TypeAlias.TypeAlias declaration
Print an Elm.Syntax.Expression.Expression
Print a single Elm.Syntax.Expression.Case
Print an Elm.Syntax.Pattern.Pattern
Print an Elm.Syntax.ModuleName.ModuleName
Print a name with its qualification ([] for no qualification)
If you need other syntax printing like for collapsible comments to be exposed, open an issue
All other helpers in this module produce a
Printwhich you can in the end convert to a String withtoString