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

GHC ghc-devs at haskell.org
Thu Apr 20 07:48:48 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:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * keywords:   => LevityPolymorphism


Comment:

 Yes, you are right: I think `coerce` (and similarly `Coercible`) should
 have type
 {{{
 coerce :: forall l (a::TYPE l) (b::Type l). a -> b
 }}}
 More realistically than your example, I think we might reasonably want
 {{{
 newtype Age = MkAge Int

 f :: Array# Age -> Array# Int
 f a = coerce a
 }}}

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


More information about the ghc-tickets mailing list