Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,334
    • Issues 4,334
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 368
    • Merge Requests 368
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14094

Closed
Open
Opened Aug 06, 2017 by Ryan Scott@RyanGlScottMaintainer

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
Assignee
Assign to
8.4.1
Milestone
8.4.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#14094