Skip to content

Unlifted newtypes via GADTSyntax

GHC disallows to define a newtype of an unlifted type (newtype A = A Int#). However, this restriction is not enforced when the newtype is defined using GADT syntax:

newtype A where
  A :: Int# -> A

For example, I can derive Show for A and on my machine main = print (A 0#) segfaults.

Tested on GHC 8.0.1 and master.

Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
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