[GHC] #10635: -fwarn-redundant-constraints should not be part of -Wall
GHC
ghc-devs at haskell.org
Wed Feb 17 08:39:19 UTC 2016
#10635: -fwarn-redundant-constraints should not be part of -Wall
-------------------------------------+-------------------------------------
Reporter: Lemming | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 7.11
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: #9939, #9973, | Differential Rev(s):
#10100, #10183 |
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Lemming):
Replying to [comment:8 Lemming]:
> If would prefer to disable the warning per constraint. E.g. I could wrap
a not strictly needed constraint in a magic {{{Used :: Constraint ->
Constraint}}}. However, this would not be possible in Haskell 98.
A Haskell 98 compliant pragma might look like this:
{{{#!hs
{-# MINIMAL_CONSTRAINTS singleton () #-}
singleton :: Ord a => a -> Set a
}}}
The pragma means: Type check "singleton" two times, once with the
constraints `()` and once with the constraint `Ord a`. Warn about
redundant constraints in the pragma but not in the signature of
`singleton`.
If you also want to warn about not maximally general types, then the
pragma should even mention the whole type signature, e.g.
{{{#!hs
{-# MOST_GENERAL singleton :: a -> Set a #-}
singleton :: Ord a => a -> Set a
{-# MOST_GENERAL asTypeOf :: a -> b -> a #-}
asTypeOf :: a -> a -> a
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10635#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list