Fri, 17 Oct 2008
Last night was the 8th meeting of FP-Syd, the Sydney Functional Programming group with huge turnout of 36 people. We had had three presentations with a very heavy Haskell slant.
First up was Conrad "kfish" Parker giving a introduction to type level programming in Haskell. This talk was a simplified version of his paper in issue 8 of the Monad Reader which described solving the Instant Insanity puzzle in Haskell's type system.
Conrad's type level programming solution uses Haskell's type system (specifically a feature called Functional Dependencies) to generate a solution so that the executable program created by the compiler needs to do nothing more than print the result. This is possible because Haskell's type system is a Turing complete logic programming language (much like the way C++'s template system is a Turing complete functional language).
The motivation for Type Families was to allow the programmer to be able to give the compiler better hints on how to optimize things, but the resulting feature goes far beyond that. The example Manuel gave was defining a data type as an array of (Int, Bool) pairs which would normally be un-boxed requiring two pointer de-references to access a part of the pair at a given index. Type Families however allow the programmer to supply hints to the compiler that it should store these as a pair of contiguous arrays, one for the Ints and one for the Bools.
Finally Manuel mentioned that since Type Families can do everything Functional Dependencies can (and more), but in a cleaner way, that Functional Dependencies may eventually be removed from the language.
Last up we had Simon Winwood giving us a demonstration that Monads aren't just for I/O. Simon's presentation was in many ways a follow on from Manuel Chakravarty's "Monads are Not Scary" presentation from the 2nd FP-Syd meeting. He demonstrated an interpreter for a simply language and used the State monad to handle state, Reader monad to read input and the Error monad for error handling.
Once again a big thank you to Google for supplying the venue as well as food and drinks. Next month we will be moving to Thoughtworks for the first of a series of meetings. I look forward to more head exploding concepts.