[GHC] #10982: Warn about unused pattern variables in type families

GHC ghc-devs at haskell.org
Sun Dec 6 16:26:06 UTC 2015


#10982: Warn about unused pattern variables in type families
-------------------------------------+-------------------------------------
        Reporter:  jstolarek         |                Owner:  msosn
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.11
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by jstolarek):

 Replying to [comment:2 msosn]:
 > The code below is accepted when the extension is disabled, because the
 identifiers starting with _ are parsed as ordinary type variables. From
 what I read on the ghc mailing list, the type families should also be
 accepted with the NamedWildCards on. If so, shouldn't the wildcards be
 treated as type variables in the other cases as well?
 I think you're right. I mean if this code is valid when `NamedWildCards`
 are turned off, then it certainly should be valid when we enable
 `NamedWildCards`. After all named wild cards can't possibly appear in any
 of these declarations, so whenever a name that looks like a wildcard
 appears we can safely assume that it must be a type variable. Note
 however, that we only want to generate warnings for unused pattern
 variables in type families.

 > I also wonder if the warnings in type families should be enabled with
 the -fwarn-unused-matches option or should I make a new flag?
 I say we use the existing flag. If anyone complains that they want a
 separate flag for unused type-level patterns then we can add it.

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


More information about the ghc-tickets mailing list