Haskell Symposium

Not sure if I got very much out of the Haskell Symposium today. After three days of ICFP I think I’m just a bit overloaded. On the plus side, every single talk contained at least one interesting nugget, but overall there wasn’t anything which really excited me. It was nice to see more about how GHC works. And I was certainly interested to hear about Jean-Philippe Bernardy’s lazy parsers from Yi – I had worried that it would be quite easy to trip up and accidentally cause everything to be evaluated, and indeed it sounds like that’s probably true. Conal Elliott’s talk about FRP reminded me about my previous (non-FRP!) job writing various physics simulators .. having done it in an imperative and stateful fashion, I completely understand the appeal of a composable declarative approach!

One other thing I noticed today; I keep forgetting that each ~30 minute talk is actually a distillation of maybe a year’s worth of work. Therefore, everyone who talks appears to me to have a superhuman ability to recognize problems, generalize them and instantly apply complex idioms to form a solution! Given the breadth of material covered at the conference, it’s somewhat of a whirlwind. But, whilst I only understand some modest fraction of what I’ve seen, I am starting to get a better idea of what kind of stuff people are working on, and what kind of approaches people take. It also makes me more aware of what kind of things I find interesting (and conversely, not interesting!) and where I might better target my efforts in the future.

ICFP – the best bits

So, for me, the best bit of ICFP was a common theme which underpinned a few of the talks. It was the idea that you can use programming as a way to learn stuff, rather than just a way to produce programs to run. In other words, the primary outcome of your programming session is an “aha” moment in your head, and if you get a runnable program too then that’s a secondary benefit but not the main objective.

So I’m not talking about learning how to program better. I’m talking about using a programming language as a way of writing down ideas. The act of writing them down often clarifies your mind. But then, as you write down more stuff you might notice commonality – and programming languages often let you capture that commonality and express it quite cleanly. And, perhaps, the resulting version will be something you didn’t ever anticipate – perhaps letting you see that two seemingly unrelated areas were in fact just two facets of one common underlying idea.

This theme came out clearly during the talks by Dan Piponi (sigfpe) and Conal Elliott; I didn’t manage to follow everything they covered, but to me they were both examples of this kind of approach. Very sweet, and much more interesting than ‘programming for programmings sake’.

ICFP day 2/3

Day 2 opened with Benjamin Pierce summarizing his experiments in making heavy use of a proof assistant (Coq) during his CS class. Basic summary was “its hard work for the organizer, but the students appear to gain a better understanding”. More concretely, he’s shared the coursework so that other people (ie. me!) can use it without having to fly out to the University of Pennsylvania.

Next two talks were over my head; I’m always surprised that naming and binding cause so much headache for formal systems. I’ve seen De Bruijn indices used before, but they cause people to drown in unhelpful arithmetic and so people look for other ways. Anyhow, I know I know nothing about this (although Sam Lindley did give me a high level overview), so I will skip onwards.

“Finding race conditions in Erlang” was practical and interesting – trying to find internal race conditions in a service by concurrently calling its api methods in random order. Well, ‘random’ order wouldn’t be so helpful, since part of the work was to find minimal examples where the concurrent calls had behaved differently from if they’d been called serially. They use quickcheck to generate the call sequences (and benefit from its minimization features) but they had to hook the Erlang VM at various points so they could control the scheduler and get some modicum of repeatability during their runs.

“Partial memoization of concurrency and communication” was more interesting than the title suggested. Memoizing pure functions is pretty easy – you do the work once, and stash the answer in a cache keyed off the argument values. However, for side-effectful computations this doesn’t work, since getting the right answer out without performing the side effects just ain’t the same thing. So, the idea was to track the side effect (specifically, message sends/receives in CML) and attempt to re-enact those interactions in a kind of ‘replay mode’. If all the interactions could be carried out just like in the original run, great, you can return the final answer and you’re done. But if the replay fails part way through, you can resume the execution of the original code (a continuation) from that point and at least you saved some work.

Emacs unicode fu

Fifteen years and still learning: C-u C-\ TeX in emacs chooses the tex input system; if you then type \forall or \exists, it’ll insert the appropriate unicode codepoint. Sweet! It’s an input mode, not a major/minor mode. It has very nice tab completion too. Picked this up during a random ICFP conversation. 🙂

[update: fixed the key binding! ]

ICFP day 1

Day one of the ICFP functional programming conference. It got off to a great start (for me, at least) with Guy Steele making a call to abandon outdated programming practices based around inherently sequence datastructures such as linked lists, instead favoring those with more opportunities for divide-and-conquer parallelism such as balanced trees (conc trees in lisp) – both can be used to represent ordered collections, but the latter gives you nice ways to split off subprograms which can be computed in parallel. And, since the same kinds of ‘recombine partial results’ strategies crop up again and again they can be factored out, and in the Fortress language, given a very concise notation. Guy described one common ‘useful trick’ to avoid some data-dependencies across the sub-problems, which was to accumulate some ‘extra information’ up as you recombine partial results – this reminded me a lot of Merkle trees.
Of course, along with the idea of ‘factor out strategies’ there were also many mentions of mapreduce – quote, “Map/reduce is a big deal” – which made me pleased I’d talked on this very topic at SPLS earlier this year. Enjoyable, and pretty straighforward talk (but then, I think Guy Steele can make complex things sound simple in much the same way that many other speakers do the reverse).

The other talk I was most interested in was the formally proved microkernel; however learning that an ~8kloc C program had required ~120kloc of computer-assisted proofs was somewhat sobering. The talk was very high level and didn’t include much in the way of gruesome details. Happily, a different talk featured a live theorem proving session using Coq – I’ve just started learning this myself, so it was a lot more meaningful that it might’ve otherwise been.

At these conferences, I’m never sure what fraction of the talks will be meaningful to me, given that this is effectively my hobby interest. However, I’m pretty pleased with my hit rate after today. Only one talk was content-free for me (note to self: never do a talk like that). But given that I still remember the first time I went along to SPLS years ago when I didn’t really grok monads, it was a nice contrast that I could follow a talk about the interaction of laziness and non-determinism in monadic style without difficulty; although it’s not exactly going to be immediately useful to anything I’m writing today. It’s nice to feel that my understanding has progressed a bit over the years. And it was useful to have played with arrows recently, both in the HXT xml toolkit and by reading the original Hughes paper – they came up several times.

I’m playing a “spot the kool-aid” game; trying to see how many people play the “functional => good” card without further justification. I mean, “functional” is such a broad brush – pure functional like Haskell, impure like ocaml, dynamically typed like lisp/scheme – each with their own strengths and weaknesses, and many ‘functional’ ideas have been integrated into more mainstream languages already. I can’t help imagining that if there was a ruby/c++/prolog conference next door, they would be cheering their heros and booing their villains in identical ways. Hmm, that’s probably just being harsh; in practice, everyone I have talked to so far at ICFP has seemed pretty clued up, but I do think it’s useful to apply some level of cynicism to what you see and hear. I jokingly think that a “devils advocate” panel would be fun … where experts in an area would try their hardest to convince the audience that their area is pointless/futile/flawed. Wouldn’t that be fun?