Skip to content

UNPACK is paranoid about a phantom type argument

Attempting to use code with a phantom type like the following:

newtype Id a = Id Int

inlines fine into

data Foo = Foo {-# UNPACK #-} !(Id Foo) String

but when I go to inline THAT

data Bar = Bar {-# UNPACK #-} !Foo

GHC tells me no, even though the recursive use of Foo is only through a phantom type.

Distilled.hs:3:12:
    Warning: Ignoring unusable UNPACK pragma on the
             first argument of `Bar'
    In the definition of data constructor `Bar'
    In the data type declaration for `Bar'
Trac metadata
Trac field Value
Version 7.0.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