Skip to content

"Iface type variable out of scope" when compiling with -c

Take these two files:

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeFamilies #-}
module Foo where

import GHC.Generics

type FakeOut a = Int

data family   TyFamily y z
data instance TyFamily a b = TyFamily Int (FakeOut b)
  deriving Generic1
module Bar where

import Foo
import GHC.Generics

main :: IO ()
main = print $ from1 $ TyFamily 1 2

And compile them like so:

$ ghc -c Foo.hs
$ ghc -c Bar.hs
./Foo.hi
Declaration for Rep1_R:TyFamilyab
Axiom branches Rep1_R:TyFamilyab:
  Iface type variable out of scope:  b
Cannot continue after interface file error

I can reproduce this with every version of GHC from 7.8.4 onward, so this is quite an old bug!

Trac metadata
Trac field Value
Version 8.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information