
#8827: Inferring Safe mode with GeneralizedNewtypeDeriving is wrong -------------------------------------+------------------------------------ Reporter: goldfire | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: 8226, 8745 -------------------------------------+------------------------------------ Comment (by simonpj): Replying to [comment:31 ekmett]:
is somewhat in line with what I've been playing around with to try to
work out how we can lift coercions over complex data types. Edward, I'm not following all the details of your comment here (like where is `Coercion` defined?), but it smells to me that you are hitting the the main limitation of the system as-implemented, namely the inability to abstract over a type constructor with a representational argument. Eg {{{ data T f a = MkT (f a) }}} Can I do `Coercible (T f Int) (T f Age)` (where `Age` is a newtype for `Int`)? Only if we are guaranteed that `f` will be instantiated with type constructor with representational roles. So you want higher-order roles. We know how to do that, but rejected it as Too Complicated. We could revisit that I guess. I may also be misunderstanding your problem. Perhaps it would help to exhibit the simplest case that doesn't work. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8827#comment:35 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler