Data representation, maybe reflection, laziness

Mark Carroll mark at chaos.x-philes.com
Fri Oct 31 15:06:57 EST 2003


People have been talking about transmitting Haskell values on the GHC
users' list, and I wanted to ask some more general stuff, partly out of
mild ignorance.

Ralf Hinze and Simon Peyton-Jones wrote an interesting paper on generic
programming and derivable type classes. It looked like maybe programmers
would be able to write their own "deriving xml" stuff and whatever, which
looked great because, if there's not already one out there, I'd love to
derive some read/show analogue automatically for data in some encoding
that's very efficient to write and parse (i.e. not XML (-:).

I was also wondering how the ability to write "deriving" stuff related to
what one might think of as being reflection - that is, for example, could
a definition of deepSeq be derived that automatically knows how to recurse
into and traverse data structures and make sure everything's evaluated?

This leads me to the point that little of the code I write needs laziness,
but many of my unpleasant performance surprises come from laziness. I do
find it hard to figure out where to put strictness annotations to actually
make things work - for instance, I think it's laziness things that are
causing my uses of Control.Exception.evaluate to actually work more by
trial and error. No doubt it'll all grow clearer in time. Maybe I need
"laziness annotations" instead. (-:

Still, I was wondering what current thinking and directions were with
regard to any of the above!

-- Mark


More information about the Haskell-Cafe mailing list