The binding
        let t = printQ
falls under the monomorphism restriction.  The Haskell Report would not
default (Show a), so you might think you'd get an "ambiguous type
variable" error.  But it's so annoying to get this error for
        ghci> show []
that GHCi is a bit more eager about defaulting ambiguous types: it'll
apply defaulting if all the constrained classes are standard, and at
least one of them is numeric *or* is Show, Eq or Ord.
The *or* part is the non-standard bit.

Admittedly, I'm not sure this is documented.

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-users-
| [EMAIL PROTECTED] On Behalf Of Abraham Egnor
| Sent: 23 August 2004 16:02
| To: [EMAIL PROTECTED]
| Subject: overzealous defaulting?
| 
| I'm not sure if this is an actual bug, as opposed to an odd instance
| of defaulting:
| 
| *GUI.Parser> let printQ q = runQ q >>= print
| *GUI.Parser> :t printQ
| printQ :: forall a. (Show a) => Q a -> IO ()
| *GUI.Parser> let p = printQ
| *GUI.Parser> :t p
| p :: Q Integer -> IO ()
| 
| ...but I'm not sure when that would ever be the correct behavior.
| 
| Abe
| _______________________________________________
| Glasgow-haskell-users mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to