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    | [EMAIL PROTECTED]
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume

_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to