[GHC] #14094: DeriveAnyClass doesn't warn about unimplemented type families

GHC ghc-devs at haskell.org
Sun Aug 6 18:28:08 UTC 2017


#14094: DeriveAnyClass doesn't warn about unimplemented type families
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.4.1
          Component:  Compiler       |           Version:  8.2.1
           Keywords:  deriving       |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  error/warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider this code:

 {{{#!hs
 {-# 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`!

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14094>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list