| « Gmail vs Apple Mail vs mutt | The Long Tail on Steam » |
After looking at the five pretty printing modules available on Hackage, I concluded that wl-pprint is the Right Thing; it’s a more complete version of the built-in pprint with a Pretty class included for you to implement.
I went with IPPrint instead. Why? Simpler interface: the only two functions are pprint and pshow (short for ‘pretty show’, where ’show’ is Haskell’s equivalent to toString/__str__/to_s). Your data structure just has to implement Show, which can be done automatically for most types. IPPrint must use some heuristics based on show’s string. I can come up with a few myself without trying too hard. I bet it’s not perfect, but it’s a whole lot closer to not having to think than implementing an instance of Pretty for each new data structure.
Installing IPPrint was mostly trivial. The trivial part was cabal install ipprint. The non-trivial part was installing cabal. GHC recently underwent an upgrade, and with it the HTTP library, on which Cabal relies. However, the Hackage version of Cabal still requires versions 3.0 to 3.2 of HTTP and won’t accept version 4 or higher.
This turned an “average Unix install” of four configure/build/install sequences into an “actual Unix install” of three configure/build/installs, two pull-head-from-source-controls, one piece of advice buried in a newsgroup, and a partridge in a pear tree.
At least I have darcs installed already, or the whole thing would probably have repeated itself fractally ad nauseam. I am lucky that darcs 1.0.5, a relatively ancient version, can still pull current repositories.
I guess I am complaining too much about the open source model being fragmented and slow to update in tandem. The closed source model isn’t any better; the solution there is usually to install (and use!) multiple versions of software until everybody updates. Or fabricate endless compatibility shims, but I think Windows provides a good example why nobody would want to use such a system unless forced to.