Skip to content

Panic on levity polymorphic very unsafe coerce

{-# LANGUAGE TypeInType #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE MagicHash #-}

module LevityId where

import GHC.Types
import GHC.Prim

levityPolymorphicId :: forall (a :: TYPE r). a -> a
levityPolymorphicId = unsafeCoerce#
  (GHC version 8.3.20170928 for x86_64-apple-darwin):
	runtimeRepPrimRep
  typePrimRep (a_aW0 :: TYPE r_aVZ)
  r_aVZ
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1144:37 in ghc:Outputable
        pprPanic, called at compiler/simplStg/RepType.hs:358:5 in ghc:RepType
        runtimeRepPrimRep, called at compiler/simplStg/RepType.hs:344:5 in ghc:RepType
        kindPrimRep, called at compiler/simplStg/RepType.hs:307:18 in ghc:RepType
        typePrimRep, called at compiler/simplStg/UnariseStg.hs:666:8 in ghc:UnariseStg

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

As originally mentioned here.

Trac metadata
Trac field Value
Version 8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information