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,273
    • Issues 4,273
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 413
    • Merge Requests 413
  • 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
  • #6031

Closed
Open
Opened Apr 22, 2012 by dreixel@trac-dreixel

Cannot derive instances for empty datatypes defined in other modules

In file A.hs:

module A where

data Empty

In file B.hs:

{-# LANGUAGE StandaloneDeriving #-}

module B where

import A

deriving instance Show Empty

GHC 7.5.20120421 reports:

    Can't make a derived instance of `Show Empty':
      The data constructors of `Empty' are not all in scope
        so you cannot derive an instance for it
    In the stand-alone deriving instance for `Show Empty'

But Empty has no constructors, and the problem does not arise if Empty is declared in B.

I guess the problem is in this part of the code of TcDeriv:

      	   ; let hidden_data_cons = not (isWiredInName (tyConName rep_tc)) &&
                                    (isAbstractTyCon rep_tc || 
                                     any not_in_scope (tyConDataCons rep_tc))
      	         not_in_scope dc  = null (lookupGRE_Name rdr_env (dataConName dc))
      	   ; unless (isNothing mtheta || not hidden_data_cons)
      	   	    (bale_out (derivingHiddenErr tycon))
Trac metadata
Trac field Value
Version 7.5
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#6031