|
RE: incorrect type error message: msg#00033lang.haskell.glasgow.bugs
The reason there's an error message at all is because of the monomorphism restriction. So that's not surprising. So the compiler has to solve the constraints { Num (f a), Functor f } in the absence of any other context whatsoever. So the constraint (Functor f) is certainly ambiguous, in the sense that there are many different instantiations of 'f' that could resolve it. Can you suggest a better error message? I'm always looking for ways to report errors more informatively. Simon | -----Original Message----- | From: Martin Sulzmann [mailto:sulzmann@xxxxxxxxxxxxxxx] | Sent: 25 November 2002 10:04 | To: glasgow-haskell-bugs@xxxxxxxxxxx | Subject: incorrect type error message | | Consider | | module Bug where | | e = fmap id 1 | | ghci --version | The Glorious Glasgow Haskell Compilation System, version 5.02.2 | | says | | :l Bug.hs | Compiling Bug ( Bug.hs, interpreted ) | | Bug.hs:5: | No instance for (Num (f a)) | arising from the literal `1' at Bug.hs:5 | In the second argument of `fmap', namely `1' | In the definition of `e': fmap id 1 | | Bug.hs:5: | Ambiguous type variable(s) `f' in the constraint `Functor f' | arising from use of `fmap' at Bug.hs:5 | In the definition of `e': fmap id 1 | | although | | :t (fmap id 1) | forall f a. (Num (f a), Functor f) => f a | | Clearly, 'f' is not ambiguous. | | Martin | | | _______________________________________________ | Glasgow-haskell-bugs mailing list | Glasgow-haskell-bugs@xxxxxxxxxxx | http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | incorrect type error message, Martin Sulzmann |
|---|---|
| Next by Date: | RE: incorrect type error message, Bernard James POPE |
| Previous by Thread: | incorrect type error message, Martin Sulzmann |
| Next by Thread: | RE: incorrect type error message, Bernard James POPE |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |