[GHC] #11128: New `-fwarn-noncanonical-monad-instances` warning
GHC
ghc-devs at haskell.org
Tue Nov 24 11:48:44 UTC 2015
#11128: New `-fwarn-noncanonical-monad-instances` warning
-------------------------------------+-------------------------------------
Reporter: hvr | Owner: hvr
Type: feature request | Status: patch
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version: 7.10.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D1516
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Herbert Valerio Riedel <hvr@…>):
In [changeset:"f09f2470a76bb08b7f51d2f5663daa672b86f618/ghc"
f09f2470/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="f09f2470a76bb08b7f51d2f5663daa672b86f618"
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
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11128#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list