[Haskell-cafe] Language extensions [was: Memoization]

Andrew Coppin andrewcoppin at btinternet.com
Sun May 27 10:06:32 EDT 2007


>> Erm... oh...kay... That kind of makes *slightly* more sense now...
>
> I wrote most of the second article, I'd appreciate any feedback you
> have on it.

If I'm understanding this correctly, existentially quantified types
(couldn't you find a name that's any harder to
remember/pronounce/spell?) provide an opaque and nonintuitive syntax for
writing a type with a type variable "hidden" inside it. Is that about right?

> Ever tried writing a nontrivial Haskell program? Like you said, they
> require these type system extensions! :) Obviously they don't
> "require" them, Haskell 98 is a Turing-complete language, but they're
> useful to avoid things like code-reuse and coupling. One of Haskell's
> design aims is to act as a laboratory for type theory research, which
> is one of the reasons why there are so many cool features to Haskell's
> type system.

(Nitpick: Code-reuse is not something to "avoid". Perhaps you meant
"code duplication"?)

I'm curiose about your assertion that Haskell was "designed" for type
system experiments. According to a paper I read recently, Haskell was
actually designed to be a single, standardised functional language
suitable for teaching. The fact that there are a lot of type system
experiments is an unexpected accident, "probably due to Haskell already
having type classes". Or so the paper says anyway...

> Anyway, existential types (and higher-rank polymorphism), along with
> multi-parameter type classes, some kind of resolution to the "MPTC
> dliemma" -- so functional dependencies or associated types or
> something similar -- and perhaps GADTs are really the only large type
> system extensions likely to make it into Haskell-prime. They're really
> more part of the Haskell language than extensions now, so well-used
> are they.

In my book, if it's difficult to explain what a feature even *does*, you
have to wonder if that feature is really necessary...

MPTCs are a simple enough extension to the existing type system -
instead of 1 type, you can have several. I can think of an immediate
application for this:

class Convertable a b where
convert :: a -> b

(I doubt I'm the first to hit upon this one.)

Associated types look very interesting, useful and intuitive. I *swear*
I read somewhere that they're in GHC 6.6.1... but apparently I'm
mistaken. :-( This is probably *the* only extension I actually want to
see in Haskell-Prime.

Apart from that, we have GADTs (um... why?), rank-N polymorphism (er...
what?), functional dependencies (I don't get it), overlapping instances
(why?), impredictive exceptions (again, I can't even comprehend what
this *is*)... the list just goes on and on!

If there's a simple, comprehensible language extension that solves a big
class of problems, sure, knock yourself out! But this just seems like
every time somebody finds a small problem it's like "hey, let's invent a
whole new branch of type theory just to solve this particular edge case..."

Hmm. I'm ranting...



More information about the Haskell-Cafe mailing list