BAM Weblog

Roy - Pretty Printing

Brian McKenna2011-12-11

This week I created an initial version of a pretty printer for Roy code. The REPL will now take a :s command pointing at a bound name, like so:

roy> let x= \a->   a+ 100
roy> :s x
\a -> a + 100

Notice that it pads out the operators. It also works on things like arrays and objects:

roy> let y = [1,2,3]
roy> :s y
[1, 2, 3]
roy> let z = {a: 1   , b:true, c:   "three"}
roy> :s z
{a: 1, b: true, c: "three"}

I have futures plans to expand this into a standalone formatter so that Roy source will have something like gofmt.

In other Roy news:

Please enable JavaScript to view the comments powered by Disqus.