[Haskell-cafe] Language extensions

David House dmhouse at gmail.com
Mon May 28 05:25:34 EDT 2007


On 27/05/07, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
> Almost all language extensions seem to be of the form "hey, let's see
> what happens if we randomly change the type checking rules so that
> *this* is permitted. What would that be like?" Usually it's an extreme
> struggle to even wrap my brain around what the extension *is*, never
> mind why this would be a useful thing...

I've read through pretty much all your arguments, and I think they
boil down to this:

"I don't understand why X is useful, and therefore it can't be useful."

Probably the reason why you don't understand why X is useful is
because you don't understand X itself in the first place. How can you
claim GADTs, existentials etc. aren't useful without understanding
what they are in the first place? If you're looking for a good
reference to learn these, I suggest the papers apfelmus pointed you
towards, or the Wikibook at http://en.wikibooks.org/wiki/Haskell.

Moreover, if you've ever written a full-sized Haskell program you'd
probably find a use case for at least one of these extensions. For
example, you're writing low-level code, and you want in-place array
updates. Sounds like a job for the ST monad, which would completely
crippled and inherently type-unsafe without rank-2 polymorphism. Or
say, as I have done recently, you're writing some forum software, and
have a type to represent a Forum, Thread and Post. Now say you want to
write some generic code to handle the addition of any one of these --
so this one piece of code allows you to add a new forum, thread or
post. Without a splattering of type-system extensions (I used at least
MPTCs, FDs and existentials), this isn't going to be possible.

-- 
-David House, dmhouse at gmail.com


More information about the Haskell-Cafe mailing list