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
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
The reason there's an error message at all is because of the
monomorphism restriction. So that's not surprising.
Can you suggest a better error message? I'm always looking for ways to
report errors more informatively.
It may be hard to do, but it would be helpful in cases like this for
the
Bugs item #643878, was opened at 2002-11-26 01:12
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=108032aid=643878group_id=8032
Category: Prelude
Group: 5.04.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Mike Gunter (magunter)
Assigned to:
Bugs item #643878, was opened at 2002-11-26 01:12
You can respond by visiting:
https://sourceforge.net/tracker/?func=detailatid=108032aid=643878group_id=8032
Category: Prelude
Group: 5.04.1
Status: Open
Resolution: None
Priority: 7
Submitted By: Mike Gunter (magunter)
Assigned to: