
#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): I'll keep it, I want to add another example I that could be derived {{{#!hs newtype Foo a = Foo (forall xx. Show a => IO xx) deriving newtype Alternative instance Functor Foo where instance Applicative Foo where }}} currently we can write this mess {{{#!hs instance Alternative Foo where empty :: Foo a empty = Foo (coerce (empty @IO @xx) :: forall xx. IO xx) (<|>) :: Foo a -> Foo a -> Foo a Foo a <|> Foo b = Foo (coerce ((<|>) @IO @xx a b) :: forall xx. IO xx) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14070#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler