[GHC] #11309: Warn on shady data constructor export

GHC ghc-devs at haskell.org
Wed Dec 30 16:18:30 UTC 2015


#11309: Warn on shady data constructor export
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:
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 dfeuer):

 Replying to [comment:2 mpickering]:
 > I don't understand the situation where this warning would be useful. If
 you want to export all the constructors then can you not use a wildcard?
 If this warning is implemented and turned on by -Wall then is there any
 way to export some constructors warning free? It seems to me the only
 situation where you explicitly  list the constructors is when you don't
 want to export them all.
 >
 > Maybe there is a better example to do with data families which I am
 missing.

 You might want to avoid a wildcard so people reading the module header
 will see all the exported names. I would argue that it's highly unusual to
 want to export only some constructors. Generally, you either want to keep
 the type abstract or to expose it fully. Can you think of a solid reason
 for exporting only some constructors? As for turning warnings off, every
 existing warning flag has `-fno-warn-...`. This would be no different.

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


More information about the ghc-tickets mailing list