Day 245: Haskell Workshop.

autrijus on 2005-09-30T22:21:14

Today's workshop has been a blast. David Roundy's darcs talk covered many challenges and advantages in using Haskell to develop a real-world application; he even mentioned SVK once, in a positive light. Among other cool tricks, he employed interleave IO to separate program logic with I/O parts. I have used that trick in OpenAFP, but I'm beginning to see that has wider applications as a Pugs/Perl6 idiom -- AOP with Lazy Lists, if you will.

The Cabal/Hackage system (the equivalent of Module::Build/CPAN) generated much interest. Discussions centered around how to incite spotaneous mutual goodwill using social software frameworks, which is imho the key part of the CPAN cultural mechanism.

I'm glad to hear that the huge GHC distribution will be broken apart into various packages, to promote the sense of community library ownership. In the future, the GHC core will be minimal, just enough to run Cabal to install packages -- Perl5 porters have bounced this idea for quite some time now, and it's nice to see it happen here too. In addition, the Haskell people are also reducing the committer-bit deadlock, by adopting decentralized darcs repositories as the norm, so a change of maintainership is simply a URL redirection apart.

Another focal point is hIDE, a Haskell development environment coded in Haskell, using the GHC bindings and build structures developed in the Visual Haskell effort. The choice of Yi as the editor component is particularly interesting -- it can dynamically load and rebind plugins, including the editor core itself, preserving the editor state (undo history/workspaces) without requiring a restart like Ecplise does. I suggested to dons that we should integrate the bootloader with GHC/Cabal, so all Haskell applications compiled this way can be code-swapped on the fly, even by eval'ing code from the user. I like dynamic languages with static typing...

I helped the library effort by polishing dons's Data.FastPackedString module, so it can subsume the old Data.PackedString implementation. The new string module is very fast and supports FFI, gzip and mmap natively. It is already used in the new PIL runtime; once it's merged into GHC core, it should give string manipulation-heavy programs a nice speed boost.

Hacking of GHC core continued. Pairing with wolfgang, the new ICFP 2005 contest champion, is very exciting and fruitful. We reasoned out how to support record updators for existentially-quantified GADT types, which is starting to dangerously resemble ML-style modules.

Also, from discussion with oleg and ccshan, I learned that GHC is actually well-equipped to natively support delimited continuations in the runtime. If implemented, Pugs's Haskell runtime can do away with the space-intensive ContT monad transformer thunks, and get a massive speed boost without changing a line of code. simonmar showed me the GHC runtime scheduler, and indeed there seem to be native support in the form of thunk-capturing asynchronous exceptions (which will incidentally give native support for the Perl6 $!.resume). Using a similar mechanism, we can also get a stack trace -- easily the #1 requested debug feature -- from fatal errors, at least when compiled for profiling.

Whew. That's a lot of hacking. Tomorrow I'll go back coding in MM2 and full Cabal support, and investigate full continuations on top of Perl5 VM. Stay tuned!