diff options
author | Austin Seipp <austin@well-typed.com> | 2013-09-09 13:40:06 -0500 |
---|---|---|
committer | Austin Seipp <austin@well-typed.com> | 2013-09-11 19:54:36 -0500 |
commit | 75a9664af1c4e6f87794b49a215adb235b20696d (patch) | |
tree | 1748f512a2bde8c58b1e9c34c22203b0b20541ca /compiler/main | |
parent | b20cf4ecbf244f091f4084c11ae2350d248ce6ef (diff) | |
download | haskell-75a9664af1c4e6f87794b49a215adb235b20696d.tar.gz |
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>
Diffstat (limited to 'compiler/main')
-rw-r--r-- | compiler/main/DynFlags.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index bcf4ccf370..965683c177 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -433,6 +433,7 @@ data WarningFlag = | Opt_WarnUnusedMatches | Opt_WarnWarningsDeprecations | Opt_WarnDeprecatedFlags + | Opt_WarnAMP | Opt_WarnDodgyExports | Opt_WarnDodgyImports | Opt_WarnOrphans @@ -2503,6 +2504,7 @@ fWarningFlags = [ ( "warn-warnings-deprecations", Opt_WarnWarningsDeprecations, nop ), ( "warn-deprecations", Opt_WarnWarningsDeprecations, nop ), ( "warn-deprecated-flags", Opt_WarnDeprecatedFlags, nop ), + ( "warn-amp", Opt_WarnAMP, nop ), ( "warn-orphans", Opt_WarnOrphans, nop ), ( "warn-identities", Opt_WarnIdentities, nop ), ( "warn-auto-orphans", Opt_WarnAutoOrphans, nop ), @@ -2916,6 +2918,7 @@ standardWarnings = [ Opt_WarnOverlappingPatterns, Opt_WarnWarningsDeprecations, Opt_WarnDeprecatedFlags, + Opt_WarnAMP, Opt_WarnUnrecognisedPragmas, Opt_WarnPointlessPragmas, Opt_WarnDuplicateConstraints, |