id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
6031	Cannot derive instances for empty datatypes defined in other modules	dreixel		"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))
}}}
"	bug	closed	normal		Compiler	7.5	fixed			Unknown/Multiple	Unknown/Multiple	None/Unknown	Unknown	deriving/should_compile/T6031			
