[commit: ghc] master: Implement new `-fwarn-noncanonical-monad-instances` (f09f247)

git at git.haskell.org git at git.haskell.org
Tue Nov 24 11:48:48 UTC 2015


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

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

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

commit f09f2470a76bb08b7f51d2f5663daa672b86f618
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Tue Nov 24 12:46:33 2015 +0100

    Implement new `-fwarn-noncanonical-monad-instances`
    
    Warn about incoherent/non-canonical 'Applicative'/'Monad' instance
    declarations. Specifically the following invariants are checked:
    
    In 'Monad' instances declarations warn if the any of the following
    conditions does not hold:
    
     * If `return` is overridden it must be canonical (i.e. `return = pure`).
     * If `(>>)` is overridden it must be canonical (i.e. `(>>) = (*>)`).
    
    In 'Applicative' instance declarations:
    
     * Warn if 'pure' is defined backwards (i.e. `pure = return`).
     * Warn if '(*>)' is defined backwards (i.e. `(*>) = (>>)`).
    
    NB, this warning flag is not enabled via `-Wall` nor `-Wcompat`.
    
    This addresses #11128
    
    Reviewers: quchen, austin, bgamari
    
    Reviewed By: bgamari
    
    Differential Revision: https://phabricator.haskell.org/D1516


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

f09f2470a76bb08b7f51d2f5663daa672b86f618
 compiler/main/DynFlags.hs                          |  3 +
 compiler/rename/RnSource.hs                        | 91 +++++++++++++++++++++-
 docs/users_guide/7.12.1-notes.rst                  |  4 +
 docs/users_guide/using-warnings.rst                | 22 ++++++
 testsuite/tests/warnings/should_compile/T11128.hs  | 50 ++++++++++++
 .../tests/warnings/should_compile/T11128.stderr    | 20 +++++
 testsuite/tests/warnings/should_compile/all.T      |  1 +
 utils/mkUserGuidePart/Options/Warnings.hs          |  9 +++
 8 files changed, 199 insertions(+), 1 deletion(-)

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 f09f2470a76bb08b7f51d2f5663daa672b86f618


More information about the ghc-commits mailing list