Type class inference trouble

Marcin 'Qrczak' Kowalczyk qrczak@knm.org.pl
16 Feb 2001 07:56:42 GMT

Thu, 15 Feb 2001 21:08:13 -0500, Dylan Thurston <dpt@math.harvard.edu> pisze:

> On Thu, Feb 15, 2001 at 02:37:09PM -0500, Ken Shan wrote:
> >     test2 = apply [int 3] (apply [(+)::Int->Int->Int] [int 5])
> What's strange is that when I tried this just now, the identical line at
> the interpreter prompt returned the correct answer [8].  This is with
> Hugs from February 2000; I'm about to download and try the new version.

The monomorphism restriction bites again. A variable binding without
a type signature is monomorphic...

It's another question whether the error is OK, but this explains the
difference between the toplevel definition and expression entered at
the prompt. Anyway, adding an explicit type signature should help.

ghc and nhc98 can be told to ignore the monomorphism restriction.

 __("<  Marcin Kowalczyk * qrczak@knm.org.pl http://qrczak.ids.net.pl/
  ^^                      SYGNATURA ZASTĘPCZA