My implementation from NICTA's functional programming workshop.

Throw-away pull request so you can grab the code.