Re: [GHC] #13595: Should ‘coerce’ be levity polymorphic?

GHC ghc-devs at haskell.org
Mon Aug 21 14:28:04 UTC 2017


#13595: Should ‘coerce’ be levity polymorphic?
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
                                     |  LevityPolymorphism
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #13592            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 The ability to write `coerceTuple` is an entirely separate matter, IIUC.
 You're asking for the `Coercible` solver to have extra knowledge about
 unboxed tuple representations that it's currently not privy to.

 With levity polymorphic `coerce` you could go from `(# Int #)` to `(# Age
 #)`, where `Age` is a newtype around `Int`. But you'd need some extra
 juice to go from `(# Int #)` to, say, `(# Int, (##) #)`.

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


More information about the ghc-tickets mailing list