Hi Mark, all:  thanks for the swiftly muddle-dispelling response.

> | Here's some of the threatened examples:
> | 
> | > data OrdFuncExist = OE (Ord a => Char -> a)
> | > data OrdListExist = OLE (Ord a => [a])
> 
> Perhaps this is a GHC/Hugs difference, but the syntax that you've
> used here isn't permitted in Hugs ... and in old versions where it
> might have been allowed, it would suggest *universal* quantification
> rather than existential.

Must be such a difference.  This is what ghc accepts, and documents:
the user guide even claims to following hugs, here, so that'll be a
tad out of date, then...


> I just rewrote the definitions to fit with the Hugs syntax for
> existentials as follows:
> 
> > data OrdFuncExist = forall a. Ord a => OE (Char -> a)
> > data OrdListExist = forall a. Ord a => OLE [a]
> 
> and now the rest of the code that you sent type checks without any
> apparent problem, including emap, blah, and emax.

It does me ego no end of good to find out that I'm right, and the
compiler is wrong (for a change, it must be said...).  Unless either
ghc or hbc catch up to the Hugs extension, though, avails me little
in practice, sadly.  (Hint, hint.)


> [We keep trying to argue that it makes sense to use the "forall" keyword
> here (because the constructor function that is being defined really does
> have a polymorphic type).  But perhaps this is a further indication that
> the time for a "exists" keyword has come!]

The forall looks syntactically _unnecessary_, slap-bang next to a context,
but it's not confusing in and of itself -- well, not beyond my usual
level of confusion about positive and negative quantifier occurrences.
(Different systems and different docs certainly are, though.)

Cheers,
Alex.

Reply via email to