
#11582: Redundant constraints warning complains that (a ~ b) is redundant -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Lemming): I thought a bit about it and found that equality constraints and type class constraints actually differ in the following aspect: If you remove a redundant type class constraint from a function type signature then any code depending on that function will continue to be type correct and continue to work as before. In contrast to that, if you remove an equality constraint (or generalize a function like asTypeOf to a more general type), then code might no longer pass the type checker because of ambiguous types. That is, if you eagerly remove all redundant constraints then removed type class constraints will not do any harm but removed equality constraints might do so. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11582#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler