[GHC] #12959: GHC doesn't warn about missing implementations for class methods beginning with an underscore
GHC
ghc-devs at haskell.org
Sun Dec 11 01:10:20 UTC 2016
#12959: GHC doesn't warn about missing implementations for class methods beginning
with an underscore
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: Other | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by RyanGlScott:
@@ -26,1 +26,1 @@
- Bug.hs:7:10: warning: [-Wmissing-methods]
+ Warn.hs:7:10: warning: [-Wmissing-methods]
New description:
This code compiles without any warnings!
{{{#!hs
{-# OPTIONS_GHC -Wmissing-methods #-}
module Bug where
class Foo a where
_Bar :: a -> Int
instance Foo Int
}}}
This code, however, //does// emit a warning:
{{{#!hs
{-# OPTIONS_GHC -Wmissing-methods #-}
module Warns where
class Foo a where
bBar :: a -> Int
instance Foo Int
}}}
{{{
Warn.hs:7:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘bBar’
• In the instance declaration for ‘Foo Int’
}}}
The only difference is in the name of the class method of `Foo`. Namely,
when a class method is prefixed with an underscore, GHC seems to look the
other way when checking if any instances are missing an implementation of
it.
I'd argue that this behavior is incorrect, since I can't envision any
scenario in which you'd want the compiler //not// to warn you about
missing method implementations (as opposed to, say, not warning about an
unused record selector).
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12959#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list