[GHC] #7169: Warning for incomplete record field label used as function

GHC ghc-devs at haskell.org
Thu Jun 22 02:32:22 UTC 2017


#7169: Warning for incomplete record field label used as function
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.7
      Resolution:                    |             Keywords:  Warnings,
                                     |  newcomer
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:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 > `-Wpartial-records` may be unnecessary, Because I think It is same
 meaning to `-Wincomplete-patterns`.

 We could include this warning under the scope of `-Wincomplete-patterns`,
 but I think it's best to keep these two things separate, since one might
 conceivably wish to disable partial record warnings while still having
 `-Wincomplete-patterns` on.

 > It seems useful. But, I do not know if it should affect coding style.
 > Is there any existing design that control warnings by function (or
 variable) name?

 Yes. The underscore prefix is already an established convention for
 silencing other warnings. For instance, in the code below, GHC will warn
 about an unused variable `x` in a pattern match:

 {{{#!hs
 f x = 42
 }}}

 But GHC will not warn if you prefix `x` with an underscore:

 {{{#!hs
 f _x = 42
 }}}

 Similarly, if you have an unused top-level function, GHC will normally
 warn about it:

 {{{#!hs
 module M (a) where

 a, b :: Int
 a = 1
 b = 2
 }}}

 But not if it's prefixed with an underscore:

 {{{#!hs
 module M (a) where

 a, _b :: Int
 a = 1
 _b = 2
 }}}

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


More information about the ghc-tickets mailing list