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

GHC ghc-devs at haskell.org
Mon Jun 19 05:13:16 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 nakaji_dayo):

 > It would be great if GHC could produce a warning if I use quux as a
 function somewhere in my code

 Do you think should be warn at when **using quux** ?  \\
 I thought it might be necessary when defining `quux`.

 {{{
 data Foo = Bar { frob :: Int } | Baz { frob :: Int, quux :: Bool } --
 maybe here

 f :: Foo -> Bool
 f x = quux x -- here?
 }}}


 Because, I think simply,  `quux` function is `quux (Baz _ x) = x` then it
 is non-exhaustive and should be warned.

 And, if it in "when use", is this warning done recursively?
 {{{
 data Foo = ...

 f = quux
 g = f -- warn here also?
 }}}

 I'm sorry if I was wrong.

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


More information about the ghc-tickets mailing list