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

GHC ghc-devs at haskell.org
Wed Sep 27 07:33:23 UTC 2017


#7169: Warning for incomplete record field label used as function
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  nakaji_dayo
            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 mgsloan):

 I think addressing this is important, otherwise it can be easy for people
 to write code that throws exceptions, without realizing it.

 I don't like the name `-Wpartial-records`, the name could be construed to
 refer to things like `-Wmissing-fields` and `-Wincomplete-record-updates`,
 other examples of partiality in records.  Perhaps call it `-Wpartial-
 fields`?

 I think it also makes sense to have an option to emit warnings for partial
 record fields.  Perhaps call it `-Wpartial-field-usages`?  The reason this
 is helpful is that some libraries may export partial fields.  It's still
 helpful as a sanity check for users of a library to have this as an
 optional warning.

 From what I can tell, modern Haskell best practice is to eschew partial
 field declarations, so I think it makes sense to include `-Wpartial-
 fields` in `-Wall`, but not `-Wpartial-field-usages`.

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


More information about the ghc-tickets mailing list