[GHC] #11451: Inconsistent warnings for unused binders in type and instance declarations

GHC ghc-devs at haskell.org
Mon Jan 25 08:42:56 UTC 2016


#11451: Inconsistent warnings for unused binders in type and instance declarations
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  bug               |               Status:  patch
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             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):  Phab:D1825
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Replying to [comment:28 RyanGlScott]:
 > Simon, I believe we will have precisely what you described with
 Phab:D1825. `-Wname-shadowing` controls unused `forall`-ed type variables,
 and `-Wtype-variables` controls unused type patterns separately. You can
 enable different combinations of them to achieve A, B, and C.

 OK good.  Minor suggestions:

 * Personally I think `-Wunused-matches` is a bit surprising as a control
 for `forall`'d type variables. I suggest `-Wunused-foralls`.  Having one
 more warning flag is low overhead.

 * The documentation for `-Wunused-matches` is out of date.

 * I really like the specification that: "if a type variable bound by an
 explicit, user-written forall is unused, we warn".  Let's use it for
 `-Wunused-foralls`.  And mention it in the section on explicit `forall`
 (9.14.1).

 * In the documentation for `-Wunused-type-variables` I think it is helpful
 to speak of "type patterns", and contrast with `-Wunused-foralls` (cross-
 ref in manual).

 * No one is pushing for extending `-Wunused-type-variables` to class
 instances. It's a little inconsistent but I think fair enough.  Maybe in
 the documentation for `-Wunused-type-varaibles` mention this point.


 > The only remaining question is if we want a single flag that implies C
 (my previous name suggestion was `-pedantic`). This would be pretty easy
 to implement if we wanted it, since it would just enable a superset of the
 flags implied by `-Wall`.

 Separately [wiki:Design/Warnings] is debating sets of flags.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11451#comment:31>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list