« Gmail vs Apple Mail vs muttThe Long Tail on Steam »

Installing IPPrint, Haskell pretty-printing library

29/01/09

Permalink 01:25:07 pm, 322 words
Categories: Code

Installing IPPrint, Haskell pretty-printing library

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.

2 comments

Comment from: Duncan [Visitor] Email
I'm not sure I understand the problem installing cabal-install. The released version works fine with HTTP-3.2. Why do you need it to use HTTP-4? If you need HTTP-4 for some other reason that's fine. It's ok to have HTTP-4 and 3.x installed at the same time.

BTW, ghc does not come with the HTTP package. Do you mean your distro packages the HTTP lib and only has the 4.x version?
03/02/09 @ 08:14
Comment from: sandersn [Member]
Thanks for checking, Duncan. I downloaded the newest version of HTTP and zlib from Hackage. From there I just assumed installing an older version of a library would confuse things very badly. I didn't know that HTTP 4 and 3.x could co-exist.

What version does ghc --make give when you say import Network.HTTP? The most recent? The most recently installed?
03/02/09 @ 09:29

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
powered by b2evolution