GHC 8.2.1 doesn't inform you when the monomorphism restriction kicks in anymore
This program doesn't typecheck due to the monomorphism restriction:
f = (==)
In GHC 8.0.2, the error message was quite helpful in informing you of this fact:
GHCi, version 8.0.2: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Main ( Bug.hs, interpreted )
Bug.hs:1:1: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘==’
prevents the constraint ‘(Eq a0)’ from being solved.
Probable fix: use a type annotation to specify what ‘a0’ should be.
These potential instances exist:
instance Eq Ordering -- Defined in ‘GHC.Classes’
instance Eq Integer
-- Defined in ‘integer-gmp-1.0.0.1:GHC.Integer.Type’
instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’
...plus 22 others
...plus 7 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• When instantiating ‘f’, initially inferred to have
this overly-general type:
forall a. Eq a => a -> a -> Bool
NB: This instantiation can be caused by the monomorphism restriction.
Notice the NB: This instantiation can be caused by the monomorphism restriction
part. But in GHC 8.2.1, this advice has mysteriously vanished!
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Main ( Bug.hs, interpreted )
Bug.hs:1:5: error:
• Ambiguous type variable ‘a0’ arising from a use of ‘==’
prevents the constraint ‘(Eq a0)’ from being solved.
Relevant bindings include
f :: a0 -> a0 -> Bool (bound at Bug.hs:1:1)
Probable fix: use a type annotation to specify what ‘a0’ should be.
These potential instances exist:
instance Eq Ordering -- Defined in ‘GHC.Classes’
instance Eq Integer
-- Defined in ‘integer-gmp-1.0.1.0:GHC.Integer.Type’
instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’
...plus 22 others
...plus 9 instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: (==)
In an equation for ‘f’: f = (==)
|
1 | f = (==)
| ^^^^
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |