DeriveAnyClass doesn't warn about unimplemented type families
Consider this code:
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wall #-}
module Bug where
class C a where
type T a
data D a
m :: a
instance C Int
deriving instance C Bool
Neither C
instance implements any of its type families or methods. However, the manual C Int
instance and the derived C Bool
instance give different warnings:
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
[1 of 1] Compiling Bug ( Bug.hs, interpreted )
Bug.hs:12:1: warning: [-Wmissing-methods]
• No explicit associated type or default declaration for ‘T’
• In the instance declaration for ‘C Int’
|
12 | instance C Int
| ^^^^^^^^^^^^^^
Bug.hs:12:1: warning: [-Wmissing-methods]
• No explicit associated type or default declaration for ‘D’
• In the instance declaration for ‘C Int’
|
12 | instance C Int
| ^^^^^^^^^^^^^^
Bug.hs:12:10: warning: [-Wmissing-methods]
• No explicit implementation for
‘m’
• In the instance declaration for ‘C Int’
|
12 | instance C Int
| ^^^^^
Bug.hs:13:1: warning: [-Wmissing-methods]
• No explicit implementation for
‘m’
• In the instance declaration for ‘C Bool’
|
13 | deriving instance C Bool
| ^^^^^^^^^^^^^^^^^^^^^^^^
Notice that the C Int
instance warns about the lack of an implementation for T
and D
, as expected. However, the derived C Bool
instance does not. It only warns about m
!
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |