[GHC] #16081: Clean up family instance consistency checking

GHC ghc-devs at haskell.org
Fri Dec 21 16:55:05 UTC 2018


#16081: Clean up family instance consistency checking
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.3
      Resolution:                    |             Keywords:  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"a57d5c4d3e39ab9ac2c31431b5e38818359fa5b5/ghc" a57d5c4/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="a57d5c4d3e39ab9ac2c31431b5e38818359fa5b5"
 Fix treatment of hi-boot files and dfuns

 Trac #16038 exposed the fact that TcRnDriver.checkHiBootIface
 was creating a binding, in the module being compiled, for
    $fxBlah = $fBlah

  but $fxBlah was a /GlobalId/. But all bindings should be for
  /LocalIds/ else dependency analysis goes down the tubes.

 * I added a CoreLint check that an occurrence of a GlobalId
   is not bound by an binding of a LocalId.  (There is already
   a binding-site check that no binding binds a GlobalId.)

 * I refactored (and actually signficantly simplified) the
   tricky code for dfuns in checkHiBootIface to ensure that
   we get LocalIds for those boot-dfuns.

 Alas, I then got "duplicate instance" messages when compiling
 HsExpr. It turns out that this is a long-standing, but extremely
 delicate, bug: even before this patch, if you compile HsExpr
 with -ddump-tc-trace, you get "duplicate instance". Without
 -ddump-tc-trace, it's OK.  What a mess!

 The reason for the duplicate-instance is now explained in
 Note [Loading your own hi-boot file] in LoadIface.  I fixed
 it by a Gross Hack in LoadIface.loadInterface. This is at
 least no worse than before.

 But there should be a better way. I have opened #16081 for this.
 }}}

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


More information about the ghc-tickets mailing list