[GHC] #5820: defining instance in GHCi leads to duplicated instances

GHC cvs-ghc at haskell.org
Fri Feb 10 16:34:29 CET 2012


#5820: defining instance in GHCi leads to duplicated instances
---------------------------------+------------------------------------------
    Reporter:  guest             |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  high              |   Milestone:  7.4.2           
   Component:  GHCi              |     Version:  7.4.1-rc1       
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonpj@…):

 commit 15ec88354665844635f6e16ba10902d7cc03f7ba
 {{{
 Author: Simon Peyton Jones <simonpj at microsoft.com>
 Date:   Fri Feb 10 15:33:53 2012 +0000

     Complete fix of #5820

     There are two related changes in here

     a) Fix TcRnDriver.setInteractiveContext so that it initialises
        tcg_insts and tcg_fam_insts, as well as the corresponding
        tcg_inst_env and tcg_fam_inst_env fields.  Vital!

     b) Fix FamInst.tcExtendLocalFamInstEnv for the GHCi case.
        It had a special HACK to allow family instances to be overridden
        in GHCi.  Fair enough, but
          * It was only affecting the tcg_fam_inst_env, not tcg_fam_insts
          * It overrode home-package instances as well as ones entered
            at the GHCi prompt, which probably wasn't intended.

        I fixed both of these, and also narrowed the scope of what it does
        to override only *identical* instances, rather than any ones that
        conflict.  If people yelp about this we can return to the question,
        but for now it narrows the range of the HACK

  compiler/typecheck/FamInst.lhs    |   59
 +++++++++++++++++++++---------------
  compiler/typecheck/TcRnDriver.lhs |    4 ++-
  compiler/types/FamInstEnv.lhs     |   58
 ++++++++++++++----------------------
  3 files changed, 59 insertions(+), 62 deletions(-)
 }}}

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



More information about the Glasgow-haskell-bugs mailing list