| Which is what we did in Hope+C (you have to say it out loud 
| ;-)) as well.

Yes it was, and all credit to you for doing it then.
hbc followed suit some years ago.  GHC and Hugs are latecomers.

| So that's good, I was concerned my earlier answer and 
| reference to a paper on implementation was talking about the 
| wrong thing when I kept seeing the "forall". Implementing 
| existentials in Hope+C was not hard, I wonder why it was hard 
| in GHC? (Rhetorical musing, I'll go find the answer myself.)

It wasn't hard.  The main tricky bit was making extending
our intermediate language, the polymorphic lambda calculus,
to support existentials.  In particular, a case expression
over an existential type like

  data T = forall a. C a (a->b)

needs to have a form like

  case e of
          C a (x::a) (y::a->b) -> ...right hand side...
                                            ... a is in scope here ... 

The type variable b should already be instantiated by now,
but 'a', being existential, is bound by the case pattern
match. So case expressions needed a bit of extension.

Simon

Reply via email to