April 14th, 2005

  • evan

haskell is still blowing my mind

Haskell is still blowing my mind.

In fifteen lines of code I have a simple parser for templated text which reports errors intelligently and knows how to dump its parse tree:
Collapse )

Then in ten more lines of code I have a renderer that can run templates and report errors:
Collapse )

But what's the most awesome about this all is that the language doesn't have exceptions or special support for parsing or anything; all of this can be accomplished with their unified monad syntax and a lot of abstraction. The static typing also means there ought to be no gotchas like an exception I forgot to handle or a type error.