GHC does context reduction as late as possible, so that when overlapping
instances are involved the commitment is made where maximum information
is available.
Simon
| -Original Message-
| From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Jurriaan Hage
| Sent: 17 March 2004 15:35
| To: [EMAIL PROTECTED]
| Subject: [Haskell] ghc question
|
| Hello,
|
| Given the fact that Haskell 98 demands that class constraints in an
| explicit type are
| in a normal form (either a variable, or a type variable applied to a
| list of types), it struck me
| that in the following (not very useful) program ghci yields a type
| which is not of that form.
|
| class X a where
|() :: a - a - Bool
|
| class Y a where
|() :: a - a - Bool
|_ _ = True
|
| instance Y a = X [a] where
|x y = not(head x head y)
|
| --f :: Y a = a - a - Bool
| f g h = [g] [h]
|
| Now, in ghci
| :t f yields f :: forall t. (X [t]) = t - t - Bool
|
| Hugs does reduce the type of f to the explicit type in comments.
|
| My question is: is there any special reason for this behaviour?
|
| Jur
| --
| http://www.cs.uu.nl/people/jur/progrock.html -- [EMAIL PROTECTED]
| If e-mail does not work try [EMAIL PROTECTED]
|
| ___
| Haskell mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/haskell
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell