Skip to content

Warn about useless UNPACK pragmas

I have on several occasions seen code with useless UNPACK pragmas. Example:

data Foo a b = Foo {-# UNPACK #-} !(a -> b)

or

data Enum = A Int | B Double
data Foo = {-# UNPACK #-} !Enum

By emitting a warning for those cases where the pragma has no effect we could help people understand how to use it correctly (rather than sprinkling it everywhere and hope for the best).

Trac metadata
Trac field Value
Version 6.12.1
Type FeatureRequest
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