I present a more expressive variant of Wadler’s “Prettier Printer”. --- What’s a pretty printer? You’ve probably used a code formatter like gofmt or rustfmt or JS prettier. These tools work in two steps: (i) parse the source code in a file, and (ii) print it out nicely. Step (ii) is pretty printing. Pretty printing is the reverse of parsing. Parsing turns linear text into a tree (a parse tree, which after a bit of post-processing becomes an abstract syntax tree (AST)). Pretty printi...