
#8503: New GeneralizedNewtypeDeriving check still isn't permissive enough -------------------------------------+------------------------------------ Reporter: goldfire | Owner: goldfire Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by simonpj): * cc: dimitris@…, sweirich@… (added) Comment: Wait. Suppose we have `g1 : m ~R n`, and `g2 : a ~R b`. Then you might think we can conclude that `g1 g2 : m a ~R n b`. But as you point out, our current rules say not. (I'm looking in `docs/core-spec/core- spec.pdf`.) But ''why'' do they say not? What does it mean for `m` to be representationally-equal to `n` (something that really only makes intuitive sense at kind *), other than "if you apply them to representationally-equal arguments you get representationally-equal types? Another alternative would be NOT to eta-reduce the newtype coercion. See `Note [Newtype eta]` in `TyCon.lhs`. It's much less important than it was because we are no longer coercing dictionaries. But there would still be a cost, as the note points out. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8503#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler