[GHC] #8827: Inferring Safe mode with GeneralizedNewtypeDeriving is wrong

GHC ghc-devs at haskell.org
Sat Mar 22 10:49:34 UTC 2014


#8827: Inferring Safe mode with GeneralizedNewtypeDeriving is wrong
-------------------------------------+------------------------------------
        Reporter:  goldfire          |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:  7.8.1
       Component:  Compiler          |          Version:  7.8.1-rc2
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:  8226, 8745
-------------------------------------+------------------------------------

Comment (by nomeata):

 May I throw the suggestion in comment:14 again into the ring? Most data
 types are exported with their constructors, so we want their users to
 `coerce` and GND as they wish; with that suggestion, no additional
 annotations are needed, and `coerce` can be replaced by hand-written code.

 Abstract type constructors would, under this proposal, not be coercible by
 default, but this can easily be enabled using `deriving` (even `instance
 deriving` anywhere where the corresponding manual code can be written).

 This is a variant of David’s suggestion (controlling roles in export
 lists) in that we correlate coercibility with constructor scope, but does
 not have the awkwardness of making the defining module’s export list
 special. In fact, it would quite precisely follow the guidance of “coerce
 (and GND) work exactly when you could write manual code for it”.

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


More information about the ghc-tickets mailing list