[GHC] #10635: -fwarn-redundant-constraints should not be part of -Wall
GHC
ghc-devs at haskell.org
Mon Aug 8 04:31:02 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, #11370 |
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by konn):
I need more flexible control on `-Wredundant-constraints`, too.
I'm currently maintaining library to provide algebraic structures.
In such a situation, we need '''empty''' class without any member function
to express the additional algebraic constraint.
Suppose we have following classes:
{{{
class Multiplicative r where
(*) :: r -> r -> r
class Commutative r -- without any member functions!
}}}
Until here, everything goes well.
Suppose we want to write algorithm relying on the commutativity of
multiplication:
{{{
myGreatAlgorithm :: (Commutative r) => r -> r
myGreatAlgorithm = ...
}}}
Then GHC warns about `Commutative r` as a "redundant constraint", although
it is essentially needed to work algorithm properly.
Since `Commutative` class doesn't have any member functions, workaround
adding "dead code", which is introduced in GHC users' guide, doesn't work
at all.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10635#comment:23>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list