[GHC] #10715: Possible regression in Coercible a (X a) between 7.8 and 7.10

GHC ghc-devs at haskell.org
Fri Jul 31 15:57:32 UTC 2015


#10715: Possible regression in Coercible a (X a) between 7.8 and 7.10
-------------------------------------+-------------------------------------
        Reporter:  inaki             |                   Owner:  goldfire
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by inaki):

 Replying to [comment:7 goldfire]:
 > In response to comment:5: Despite appearances to the contrary,
 `Coercible` is '''not''' a class. It is much more a special operator,
 right along the lines of `~`.
 >
 > (Historical note: when we started developing the idea that became
 `Coercible`, we thought it would indeed be a normal class, but with
 compiler-generated instances. And it started life that way. But when
 pushed, the limitations of the class-based solver became too much, and so
 `Coercible` evolved. The code in GHC that solves `Coercible` constraints
 is closely tied to solving of normal equality constraints, and not at all
 related to the code that solves class constraints.)
 >
 > Perhaps the user manual should be updated to reflect this fact about
 `Coercible`.
 Thanks for the explanation! An explanation of the subtleties when using
 Coercible in the manual would certainly help.

 Another related counterintuitive fact is that coerce itself works fine
 with the recursive newtype, the following works:
 {{{#!hs
 import Data.Coerce (coerce, Coercible)

 data X a

 --doCoerce :: Coercible a (X a) => a -> X a
 --doCoerce = coerce

 newtype Y = Y (X Y)

 test :: Y -> X Y
 test = coerce
 }}}
 but it see no way of writing doCoerce in a way that makes ghc 7.10 happy.

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


More information about the ghc-tickets mailing list