Planck Pretty

May 15, 2016

A new feature in Planck 1.12 is the use of Fipp to format REPL results. To be honest, I stole this idea from Cursive. And it's definitely worth stealing!

In short, what this gives you is formatted output for structured data. You always have cljs.pprint available. But for me, the main selling point is the "F" in Fipp's name. It is freakishly fast. Thanks to Brandon Bloom for this awesome library.

One of the things that I'll often do when developing Planck is to take a look at the compiler state atom. This is a gigantic map containing all of the analysis metadata for all of the def in cljs.core and other namespaces. It is a structure that you end up only looking at pieces of, and when you do, you really want them to be formatted.

In terms of speed, if you do the following in Planck

(cljs.pprint/pprint @planck.repl/st)

it will appear that Planck has locked up for about 10 seconds or more, and then it will print. With Fipp, printed output starts appearing instantly.

In addition to speed, you can write your own printing hooks for Fipp. With this, it is possible for Planck to also add syntax highlighting of formatted output. This even further aids in seeing what is in a large structure at a glance. Here is an example:

Since Planck has one foot in the native world, it is very easy for it to know the size of your current terminal window. It makes use of this, automatically passing the terminal width to Fipp when printing results. So, in the example above, the value of *1 was first displayed when the terminal was narrow, and then displayed again after having stretched the terminal.

You can get Planck 1.12 at

Tags: Planck ClojureScript Bootstrap