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

GHC ghc-devs at haskell.org
Wed Aug 2 13:50:52 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:12 Iceland_jack]:
 > ah! So this means we can also derive optic methods once
 `QuantifiedContexts` lands

 I'm not sure what's special about "optic methods", but yes, I'm pretty
 sure `QuantifiedContexts` should let us be able to use
 `GeneralizedNewtypeDeriving` in any situation where we need to `coerce`
 underneath a higher-kinded type parameter (like the `f` in `Lens (f a)
 a`).

 > and (possibly / hopefully) that we can derive everything derivable?

 I mean, saying that you can derive everything that is derivable is a bit
 of a tautology. But I think the answer to that question is yes :)

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

 Alas, `ImpredicativeTypes` hasn't been removed yet. Simon laid out a
 proposal for doing so, while still preserving the ability to use
 `TypeApplications` to instantiate polytypes (as in `coerce @(forall a.
 Lens (t a) a)`) [https://mail.haskell.org/pipermail/ghc-
 devs/2016-September/012824.html here], but no one has drafted that up into
 a concrete GHC proposal yet. I'd do this myself, except I'm far too
 unfamiliar with the typechecker details to come up with a comprehensive
 document explaining how this change would work.

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


More information about the ghc-tickets mailing list