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

GHC ghc-devs at haskell.org
Thu Apr 20 02:44:52 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
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #13592
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I'm not able to write `coerce @Int# @Int#` or `coerce :: Double# ->
 Double#`, just checking to see if its intentional or not

 {{{
 >>> :set -XTypeApplications
 >>> :set -XMagicHash

 >>> import Data.Coerce
 >>> import GHC.Exts

 >>>> :t coerce @Int
 coerce @Int :: Coercible b Int => Int -> b
 >>> :t coerce @Int#

 <interactive>:1:1: error:
     Couldn't match a lifted type with an unlifted type
     When matching types
       b :: *
       Int# :: TYPE 'IntRep

 <interactive>:1:9: error:
     • Expecting a lifted type, but ‘Int#’ is unlifted
     • In the type ‘Int#’
       In the expression: coerce @Int#
 }}}

 This was needed for #13592.

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


More information about the ghc-tickets mailing list