Implement the AMP warning (#8004)
authorAustin Seipp <austin@well-typed.com>
Mon, 9 Sep 2013 18:40:06 +0000 (13:40 -0500)
committerAustin Seipp <austin@well-typed.com>
Thu, 12 Sep 2013 00:54:36 +0000 (19:54 -0500)
commit75a9664af1c4e6f87794b49a215adb235b20696d
tree1748f512a2bde8c58b1e9c34c22203b0b20541ca
parentb20cf4ecbf244f091f4084c11ae2350d248ce6ef
Implement the AMP warning (#8004)

This patch implements a warning when definitions conflict with the
Applicative-Monad Proposal (AMP), described in #8004. Namely, this will
cause a warning iff:

    * You have an instance of Monad, but not Applicative
    * You have an instance of MonadPlus, but not Alternative
    * You locally defined a function named join, <*>, or pure.

In GHC 7.10, these warnings will actually be enforced with superclass
constraints through changes in base, so programs will fail to compile
then.

This warning is enabled by default. Unfortunately, not all of
our upstream libraries have accepted the appropriate patches. So we
temporarily fix ./validate by ignoring the AMP warning.

Dan Rosén made an initial implementation of this change, and the
remaining work was finished off by David Luposchainsky. I finally made
some minor refactorings.

Authored-by: Dan Rosén <danr@chalmers.se>
Authored-by: David Luposchainsky <dluposchainsky@gmail.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>
compiler/main/DynFlags.hs
compiler/prelude/PrelNames.lhs
compiler/typecheck/Inst.lhs
compiler/typecheck/TcRnDriver.lhs
docs/users_guide/7.8.1-notes.xml
docs/users_guide/flags.xml
docs/users_guide/using.xml
mk/validate-settings.mk