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

GHC ghc-devs at haskell.org
Wed Aug 2 10:22:13 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 Iceland_jack):

 Replying to [comment:7 RyanGlScott]:
 > My hunch is that just about every use case for this proposed `unsafe
 newtype` deriving strategy would be subsumed by the ability to have
 quantified contexts involving `Coercible`.

 That's excellent and I hope that is indeed the case. A choice between
 `forall a. Coercible (m (M m a)) (m (m a))` and `forall a b. Coercible a b
 => Coercible (m a) (m b)` in the context is also interesting and makes me
 wonder if they differ in that example

 ----

 Replying to [comment:11 RyanGlScott]:

 > Happily, writing instances the way `GeneralizedNewtypeDeriving` ..
 doesn't suffer from this problem.

 ah! So this means we can also derive optic methods once
 `QuantifiedContexts` lands and (possibly / hopefully) that we can derive
 everything derivable? That would be huge for me and I would be fine with
 closing this ticket

 It does require `ImpredicativeTypes` written in the Haskell surface
 language, wasn't that removed in 8.2?

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


More information about the ghc-tickets mailing list