[GHC] #12945: Backpack signature matching doesn't pick up orphan instances

GHC ghc-devs at haskell.org
Thu Dec 8 03:40:52 UTC 2016


#12945: Backpack signature matching doesn't pick up orphan instances
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:  ezyang
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:  8.2.1
          Component:  Compiler       |           Version:  8.1
  (Type checker)                     |
           Keywords:  backpack       |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Repro:

 {{{
 unit impl where
     module A where
         data T = T
     module B(module A, module B) where
         import A
         instance Show T where
             show T = "T"

 unit sig where
     signature B where
         data T = T
         instance Show T
     module App where
         import B
         app = print T

 unit main where
     dependency sig[B=impl:B]
     module Main where
         import App
         main = app
 }}}

 I get:

 {{{
 ezyang at sabre:~$ ghc-head --backpack foo.bkp
 [1 of 3] Processing impl
   Instantiating impl
   [1 of 2] Compiling A                (.hs -> .o)
   [2 of 2] Compiling B                (.hs -> .o)
 [2 of 3] Processing sig
 [3 of 3] Processing main
   Instantiating main
   [1 of 1] Including sig[B=impl:B]
     Instantiating sig[B=impl:B]
     [1 of 2] Compiling B[sig]           (.hsig -> .o)

 sig/sig-HVnmSw44WZeBfwnUur4wzl/../B.hi:1:1: error:
     No instance for (GHC.Show.Show impl:A.T)
       arising when attempting to show that
       instance [safe] GHC.Show.Show impl:A.T -- Defined in ‘impl:B’
       is provided by ‘impl:B’
 }}}

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


More information about the ghc-tickets mailing list