[GHC] #4398: Panic with FlexibleContexts and rewrite rules

GHC cvs-ghc at haskell.org
Thu Oct 21 06:16:42 EDT 2010


#4398: Panic with FlexibleContexts and rewrite rules
---------------------------------+------------------------------------------
    Reporter:  batterseapower    |        Owner:                                
        Type:  bug               |       Status:  merge                         
    Priority:  normal            |    Milestone:                                
   Component:  Compiler          |      Version:  6.12.1                        
    Keywords:                    |     Testcase:  simplCore/should_compile/T4398
   Blockedby:                    |   Difficulty:                                
          Os:  Unknown/Multiple  |     Blocking:                                
Architecture:  Unknown/Multiple  |      Failure:  Compile-time crash            
---------------------------------+------------------------------------------
Changes (by simonpj):

  * status:  new => merge
  * testcase:  => simplCore/should_compile/T4398


Comment:

 Fundamentally you can't do this.  Rewrite rules are run by the simplifier,
 and it knows nothing of instance declarations etc.  So any evidence
 (dictionaries) needed on the RHS must be available on the LHS of the rule.

 But there shouldn't be a panic.  I've improved matters as far as giving a
 (still slightly opaque) warning, and discarding the rule, rather than
 panicing.
 {{{
 Thu Oct 21 09:54:02 BST 2010  simonpj at microsoft.com
   * Improve rule checking, to fix panic Trac #4398

   Lots of comments with decomposeRuleLhs

     M ./compiler/deSugar/Desugar.lhs -9 +4
     M ./compiler/deSugar/DsBinds.lhs -75 +82

 Thu Oct 21 09:50:30 BST 2010  simonpj at microsoft.com
   * Improve the simple expression optimiser so it does simple beta
 reduction

     M ./compiler/coreSyn/CoreSubst.lhs -31 +43
 }}}
 I think this is worth merging.

 Simon

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


More information about the Glasgow-haskell-bugs mailing list