explicitly quantified classes in functions

Hal Daume III hdaume@ISI.EDU
Thu, 4 Apr 2002 12:36:44 -0800 (PST)


Why can I not define the following (in ghc):

> class Foo p where
> instance Foo Double where
> foo :: Double -> (forall q . Foo q => q)
> foo p = p

>From my humble (lack of) knowledge, there seems to be nothing wrong here,
but ghc (5.03) complains about unifying q with Double.  I *can* write:

> class Foo p where
> instance Foo Double where
> data T = forall q . Foo q => T q
> foo :: Double -> T
> foo p = T p

which is very similar, except that the explicit universal quantification
is happening in in the datatype and not the function type.

why is the former disallowed?

--
Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume