
#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, #11370 | Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): The proposal on the thread is * `-Wredundant-constraints` reports when a user writes a constraint that is fully equivalent to some other, strictly smaller constraint, like suggesting simplifying (Eq a, Ord a) to (Ord a). * `-Wtype-overly-specific` warns about any type signature that's more specific than it needs to be. That would include both (a) When a constraint is specified but not used {{{ f :: Eq a => a -> a f x = x }}} (b) When a type variable is instantiated to something more specific than necessary {{{ g :: [a] -> [a] g x = x }}} That sounds attractive but (b) isn't an easy fit with the current implementation. GHC treats a type signature as normative and "pushes it inward". So when type checking {{{ g :: [a] -> [a] g x = x && True }}} we immediately given an error "can't unify [a] with Bool". We do ''not'' infer the most general type of g, namely `g :: Bool -> Bool`, and then compare with the signature. So I don't know an easy way to do (b). But (a) would be fine. Patches welcome. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10635#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler