
#12700: Don't warn about redundant constraints for type equalities -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: -------------------------------------+------------------------------------- With `-Wall`, the following code {{{ {-# LANGUAGE TypeFamilies #-} type family Foo x where Foo Double = Int foo :: (RealFrac a, Integral b, b ~ Foo a) => a -> b foo = round }}} produces the warning {{{ • Redundant constraint: b ~ Foo a • In the type signature for: foo :: (RealFrac a, Integral b, b ~ Foo a) => a -> b }}} Technically, I suppose this is correct in the sense that if we remove the constraint `b ~ Foo a`, `foo` still compiles. However, the ''meaning'' changes without the type equality, because the function I wrote is equivalent to `foo :: (RealFrac a, Integral (Foo a)) => a -> Foo a` (which requires `-XFlexibleContexts`), while the function it suggests is the much more general `foo :: (RealFrac a, Integral b) => a -> b`. Since this is the case, I think the warning is invalid. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12700 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler