Skip to content

Scala implementation of Philip Wadler's "Prettier Printer"

Notifications You must be signed in to change notification settings

guillaumebort/prettier-scala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Scala implementation of Philip Wadler's "Prettier Printer"

See http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf

However the combinators given by Philip Wadler are not expressive enough to allow the final layout we need for most languages. For example, in Scala literal new lines in multiline strings & comments must be preserved.

To allow to force the layout, we provide a NoFlat combinator that prevent any flatten. To reflect that we change the signature of flatten to indicate that some doc cannot be flattened. In this case the group combinator does not have any effect and acts as identity.

👉 This is a toy implementation. If you are looking for a real and optimized Scala implementation you should have a look at https://github.com/typelevel/paiges.

About

Scala implementation of Philip Wadler's "Prettier Printer"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages