Implict parameters and monomorphism

Lennart Augustsson lennart@mail.augustsson.net
Thu, 03 May 2001 08:07:10 -0400


Marcin 'Qrczak' Kowalczyk wrote:

> Thu, 03 May 2001 06:29:35 -0400, Lennart Augustsson <lennart@mail.augustsson.net> pisze:
>
> > Try this program:
> > -- Try commenting out this type signature.
> > fun:: (Num a) => a -> Int
>
> Test.hs:7:
>     Ambiguous type variable(s) `a' in the constraint `Num a'
>     arising from use of `fun' at Test.hs:7
>     In the first argument of `g', namely `fun'
>     In the definition of `ii': g fun
>
> Test.hs:18:
>     Ambiguous type variable(s) `a' in the constraint `C a'
>     arising from use of `m' at Test.hs:18
>     In the first argument of `putStrLn', namely `(m ii)'
>     In the definition of `main': putStrLn (m ii)
>
> Defaulting applies only when all classes involved are Haskell 98.

First, I cannot parse that sentence, but I assume you mean when all
classes are Prelude classes.
Second, I'm pretty sure we all agreed that this was a silly rule and
should not be in the Haskell definition.  I was certain that that it had
been removed from the Haskell report, but I guess not.  (hbc used
to make this check, but I removed it when everyone seemed to
agree that rule was a bad idea).
Third, moving ii to a different module might still exhibit this problem.
(I'm not sure how ghc defaults exported definitions.)

But most importantly, this was a bad example.  There was a much better
one posted on this mailing list a while ago.  Does anyone remember it?

    -- Lennart



>
> hbc, nhc98 and Hugs are not conforming.