[GHC] #14237: -Wredundant-constraints incorrectly warns about required type equality constraints in default signatures
GHC
ghc-devs at haskell.org
Fri Sep 15 00:07:30 UTC 2017
#14237: -Wredundant-constraints incorrectly warns about required type equality
constraints in default signatures
-------------------------------------+-------------------------------------
Reporter: lexi.lambda | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
error/warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by lexi.lambda):
This actually seems worse than I thought—GHC warns even when type
equalities are clearly required. It seems like perhaps `-Wredundant-
constraints` in GHC 8.2.1 treats all type equalities as redundant? For
example, this program produces a warning:
{{{#!hs
import GHC.Exts (IsList(..))
nums :: (Num a, IsList t, Item t ~ a) => t
nums = fromList [1, 2, 3]
}}}
{{{
/private/tmp/redundant-default-
constraint/src/RedundantDefaultConstraints.hs:9:1: warning: [-Wredundant-
constraints]
• Redundant constraint: Item t ~ a
• In the type signature for:
nums :: forall a t. (Num a, IsList t, Item t ~ a) => t
|
9 | nums :: (Num a, IsList t, Item t ~ a) => t
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14237#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list