#2213: Confusing flags for rewrite rules
----------------------+-----------------------------------------------------
 Reporter:  dons      |          Owner:  dons       
     Type:  bug       |         Status:  assigned   
 Priority:  normal    |      Milestone:  6.10 branch
Component:  Compiler  |        Version:  6.8.2      
 Severity:  normal    |     Resolution:             
 Keywords:            |     Difficulty:  Unknown    
 Testcase:            |   Architecture:  Unknown    
       Os:  Unknown   |  
----------------------+-----------------------------------------------------
Changes (by simonpj):

  * summary:  -Wall incorrectly warns "Defined but not used" for functions
              exported via RULES => Confusing flags for
              rewrite rules

Comment:

 I agree this is totally weird, and we must fix it for 6.10.  The current
 situation is:
  * RULES pragmas are discarded by the lexer unless `explicitForallEnabled`
 is on
  * `explicitForAllEnabled` is set only by the flags Ian mentions above
  * Those flags are set by `-fglasgow-exts`

 There is an '''optimisation''' flag `-frewrite-rules`, which controls
 whether rewrite rules are ''applied'' during optimisation.  It's not meant
 to be a language-extension flag.

 We could have a '''language-extension''' flag `-XRewriteRules`, which
 switches on RULES in source code. (Even without it, optimisation could
 still use imported rules, as controlled by the optimisation flag
 `-frewrite-rules`.)  It could be switched on by `-fglasgow-exts`.  It
 would switch on lexing of `forall`.

 Presumably RULES should be ignored without `-XRewriteRules`.  (Would we
 want a warning?  And yet another warning-supression flag?) I'm a bit
 concerned that this would break old programs that don't use `-fglasgow-
 exts`, but do have `-XScopedTypeVariables` (say), by silently discarding
 their rewrite rules.  This seems like a strong argument for adding a
 warning for discarded RULES.  This warning would also have warned Don in
 the program that started this ticket.

 Should the optimisation flag still be called `-frewrite-rules`. I think we
 should re-title it `-frun-rewrite-rules` (implied by -O of course).

 Nothing very hard here, but better to get the design right first.
 Comments?

 Meanwhile I'll re-title the ticket.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2213#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to