DefaultSignatures: error message mentions internal name
{-# LANGUAGE DefaultSignatures #-}
class C a where
reflexive :: a -> Bool
default reflexive :: Eq a => a -> Bool
reflexive x = x == x
data D
instance C D where
-- /home/abel/play/haskell/bugs/DefaultSig.hs:10:10:
-- No instance for (Eq D) arising from a use of ‘Main.$gdmreflexive’
-- In the expression: Main.$gdmreflexive
-- In an equation for ‘reflexive’: reflexive = Main.$gdmreflexive
-- In the instance declaration for ‘C D’
Error looks odd: The user has not written $gdmreflexive in his code.
TODO: Better error message.
Maybe this should just trigger a warning that method reflexive
is undefined for instance D
of C
. Like when I remove the default method.
/home/abel/play/haskell/bugs/DefaultSig.hs:10:10: Warning:
No explicit implementation for
‘reflexive’
In the instance declaration for ‘C D’
It seems the semantics of a default signature is that each instance *must* implement this method.
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.4 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |