Re: [GHC] #14070: Allow ‘unsafe’ deriving strategy, deriving code with ‘unsafeCoerce’
GHC
ghc-devs at haskell.org
Tue Aug 1 09:10:53 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:
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):
That sounds excellent, I'm thrilled about this feature.
Incidentally is it possible to coerce `Lens s a = forall f. Functor f =>
(a -> f a)` types?
{{{#!hs
class X f where
x :: Lens (f a) a
newtype WrappedX f a = WrapX (f a)
instance X f => X (WrappedX f) where
x :: forall a. Lens (WrappedX f a) a
x = unsafeCoerce x' where
x' :: Lens (t a) a
x' = x @t @a
}}}
fails with
{{{
• Could not deduce (Functor f0) arising from a use of ‘x'’
from the context: X t
bound by the instance declaration at /tmp/uuu.hs:21:10-25
or from: Functor f
bound by the type signature for:
x :: Functor f => (a -> f a) -> Foo t a -> f (Foo t a)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14070#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list