[commit: ghc] ghc-8.0: Implement `-Wnoncanonical-monadfail-instances` warning (e4c96ca)

git at git.haskell.org git at git.haskell.org
Sun Jan 24 21:24:28 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/e4c96ca31770e6b2a16dae5bfc0e4d844a105410/ghc

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

commit e4c96ca31770e6b2a16dae5bfc0e4d844a105410
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sun Jan 24 14:46:44 2016 +0100

    Implement `-Wnoncanonical-monadfail-instances` warning
    
    The MonadFail proposal implemented so far via #10751 only warns about
    missing `MonadFail` instances based on existence of failible pattern
    matches in `do`-blocks.
    
    However, based on the noncanonical Monad warnings implemented via #11150
    we can provide a different mechanism for detecting missing `MonadFail`
    instances quite cheaply. That is, by checking for canonical `fail` definitions.
    
    In the case of `Monad`/`MonadFail`, we define the canonical implementation of
    `fail` to be such that the soft-deprecated method shall (iff overridden) be
    defined in terms of the non-deprecated method. Consequently, in case of
    `MonadFail`, the `Monad(fail)` method shall be defined as alias of
    the `MonadFail(fail)` method.
    
    This allows us at some distant point in the future to remove `fail` from
    the `Monad` class, while having GHC ignore/tolerate such literal canonical
    method definitions.
    
    Reviewed By: bgamari, RyanGlScott
    
    Differential Revision: https://phabricator.haskell.org/D1838
    
    (cherry picked from commit fd6dd41c67f3bd23bbf074357219cfd251eb53d6)


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

e4c96ca31770e6b2a16dae5bfc0e4d844a105410
 compiler/main/DynFlags.hs                          |  3 ++
 compiler/rename/RnSource.hs                        | 38 ++++++++++++++++++++++
 docs/users_guide/8.0.1-notes.rst                   |  5 +--
 docs/users_guide/using-warnings.rst                | 24 ++++++++++++++
 .../should_compile/{T11128.hs => T11128b.hs}       | 22 ++++++++++---
 .../tests/warnings/should_compile/T11128b.stderr   | 10 ++++++
 testsuite/tests/warnings/should_compile/all.T      |  1 +
 utils/mkUserGuidePart/Options/Warnings.hs          |  8 +++++
 8 files changed, 105 insertions(+), 6 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 e4c96ca31770e6b2a16dae5bfc0e4d844a105410


More information about the ghc-commits mailing list