blog.kfish.org

My name is Conrad Parker, and I live in Kyoto, Japan. I work with Renesas in Tokyo, designing the Linux multimedia architecture for a new line of mobile processors; and for Wikimedia Foundation, working on Ogg integration for Mozilla Firefox. I am also working towards a PhD in Computer Science at Kyoto University. Free software projects include the Sweep sound editor and the Annodex media system, and various smaller ones that you can read about here.

Monday, 10 September 2007

Type-Level Instant Insanity

I wrote an introductory tutorial about type-level programming, "Type-Level Instant Insanity", which is now available in the Monad.Reader, Issue 8 [PDF]. The tutorial implements a solution to the puzzle Instant Insanity, entirely in the Haskell type-system.

Familiarity with the syntax of the Haskell Type System is a prerequisite for understanding the details of general Haskell programming. What better way to build familiarity with something than to hack it to bits?

The point of the exercise is to demonstrate how the type system can be used to tell the compiler about details of logic, such as pre- and post-conditions of functions. Although type annotations are optional in Haskell, they can often be used to more clearly describe what the shape of a correct solution is; or, conversely, to tell the compiler what a bug looks like.

There is also a talk page for this article, so feel free to add random thoughts there, or here.

The Monad.Reader is "a quarterly magazine about functional programming. It is less formal than a journal, but somehow more enduring than a wiki page or blog post."

Please enjoy :-)