overzealous defaulting?
Simon Peyton-Jones
simonpj at microsoft.com
Mon Aug 23 12:14:32 EDT 2004
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: glasgow-haskell-users-bounces at haskell.org
[mailto:glasgow-haskell-users-
| bounces at haskell.org] On Behalf Of Abraham Egnor
| Sent: 23 August 2004 16:02
| To: glasgow-haskell-users at haskell.org
| 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
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list