Re: [GHC] #14070: Allow ‘unsafe’ deriving strategy, deriving code with ‘unsafeCoerce’

GHC ghc-devs at haskell.org
Wed Aug 2 15:21:41 UTC 2017


#14070: Allow ‘unsafe’ deriving strategy, deriving code with ‘unsafeCoerce’
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
                                     |  QuantifiedContexts, deriving
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 RyanGlScott):

 Replying to [comment:14 Iceland_jack]:
 > I was wondering if there is anything GNDerivable in theory that would be
 outside of GHC's reach even given quantified constraints (and your
 hunch).. Just as `join` is 'derivable' but is not derivable currently.

 In theory, //everything// is GNDable - after all,
 `GeneralizedNewtypeDeriving` is just a glorified `unsafeCoerce` hack. The
 real question is if something is GNDable //and// type-safe, but beyond
 GHC's reach.

 The only cases that I'm aware of where this happens involves roles, so if
 you find other scenarios where `GeneralizedNewtypeDeriving` emits code
 that doesn't typecheck, file another ticket.

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


More information about the ghc-tickets mailing list