[Haskell-cafe] DSL in Haskell

Don Stewart dons at galois.com
Sun Nov 15 14:27:54 EST 2009

> Hi All,
> I was reading a Ruby book and in that it was mentioned that its capability to
> dynamically query and modify classes makes it suitable for implementing DSL's
> ... I am referring to Ruby's reflection and methods like "method_missing" here.
> It can allow things like not having to define constants for all possible
> unicode code points etc...For example, first use of U0123 could bring such a
> constant definition into existence etc
> I see multiple search hits when I look for Haskell and DSL - can someone please
> point me to a good primer or explain to me how equivalent of above mentioned
> features in Ruby can be done in Haskell ... or the Haskell alternative for it.

The Haskell equivalent would be overloading, primarily via type classes.

See Lennart Augusston's BASIC for an example of this in the extreme:


That's BASIC syntax, in Haskell, relying on overloading numbers, strings
etc. And all statically typed.

For a survey of some of the more recent EDSLs in Haskell, see this brief


-- Don

More information about the Haskell-Cafe mailing list