[GHC] #15294: Unused "foralls" prevent types from being Coercible

GHC ghc-devs at haskell.org
Wed Jun 20 18:09:09 UTC 2018


#15294: Unused "foralls" prevent types from being Coercible
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:  Roles
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 goldfire):

 I think this is expected behavior.

 Representational equality still falls short of its goal of equating all
 things with equal representation. For example, `Bool` is not `Coercible`
 to `data BBool = FFalse | TTrue`, even though `Bool` and `BBool`
 (plausibly) have the same representation.

 It's true that `forall a. Int -> Bool` and `Int -> Bool` have the same
 runtime representation, but they crucially look quite different in Core. A
 member of `forall a. Int -> Bool` looks like `/\ (a :: Type). \ (x ::
 Int). ...`, while a member of `Int -> Bool` looks like `\ (x :: Int).
 ...`. One could imagine extending representational equality in this way
 (it would be sound, if we get the details right), but I don't think it's
 worth it.

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


More information about the ghc-tickets mailing list