[Haskell-cafe] GADT and typeclasses [was: Language extensions]

oleg at pobox.com oleg at pobox.com
Sun May 27 20:35:21 EDT 2007


Philippa Cowderoy wrote:
> For example, GADTs let you implement monads as interpreters by defining a
> datatype representing the abstract syntax tree that describes a
> computation - you can't get this to type without at a minimum existential
> types and for many monad operations you need the full power of GADTs to
> declare a corresponding constructor.

I'm yet to see the example of that need. I have seen the examples that
the need for GADT was _claimed_ -- but then it turns out the example
is implementable without GADT after all. Here are a few such
examples: implementing State monad in a free term algebra

	Initial (term) algebra for a state monad
	http://www.haskell.org/pipermail/haskell-cafe/2005-January/008241.html

Implementing an interpreter in HOAS with fix

	Even higher-order abstract syntax: typeclasses vs GADT
	http://www.haskell.org/pipermail/haskell/2007-January/019012.html


More information about the Haskell-Cafe mailing list