[commit: ghc] master: Improve warnings for rules that might not fire (2d88a53)

git at git.haskell.org git at git.haskell.org
Mon Jul 27 13:48:02 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2d88a531b7e4dbf4016dca4b1ba3b5dc34256cf4/ghc

>---------------------------------------------------------------

commit 2d88a531b7e4dbf4016dca4b1ba3b5dc34256cf4
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Jul 24 12:50:42 2015 +0100

    Improve warnings for rules that might not fire
    
    Two main things here
    
    * Previously we only warned about the "head" function of the rule,
      but actually the warning applies to any free variable on the LHS.
    
    * We now warn not only when one of these free vars can inline, but
      also if it has an active RULE (c.f. Trac #10528)
    
    See Note [Rules and inlining/other rules] in Desugar
    
    This actually shows up quite a few warnings in the libraries, notably
    in Control.Arrow, where it correctly points out that rules like
        "compose/arr"   forall f g .
                        (arr f) . (arr g) = arr (f . g)
    might never fire, because the rule for 'arr' (dictionary selection)
    might fire first.  I'm not really sure what to do here; there is some
    discussion in Trac #10595.
    
    A minor change is adding BasicTypes.pprRuleName to pretty-print RuleName.


>---------------------------------------------------------------

2d88a531b7e4dbf4016dca4b1ba3b5dc34256cf4
 compiler/basicTypes/BasicTypes.hs                  |  39 ++++++-
 compiler/deSugar/Desugar.hs                        | 113 +++++++++++++++------
 compiler/iface/IfaceSyn.hs                         |   2 +-
 compiler/iface/TcIface.hs                          |   5 +-
 compiler/typecheck/TcRnTypes.hs                    |   2 +-
 .../tests/indexed-types/should_compile/Rules1.hs   |   1 +
 .../tests/indexed-types/should_compile/T2291.hs    |  18 +++-
 testsuite/tests/simplCore/should_compile/T5776.hs  |  16 +--
 .../simplCore/should_compile/T6082-RULE.stderr     |   8 +-
 testsuite/tests/simplCore/should_compile/T7287.hs  |  11 ++
 testsuite/tests/typecheck/should_compile/tc111.hs  |   1 +
 11 files changed, 167 insertions(+), 49 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 2d88a531b7e4dbf4016dca4b1ba3b5dc34256cf4


More information about the ghc-commits mailing list