Skip to content

UNPACK support for sum types

Currently the pragma only supports single-constructor types. So in the following example it will simply be ignored:

data A = 
  A1 Char |
  A2 {-# UNPACK #-} !B

data B = 
  B1 Int |
  B2 Bool

However the problem seems to be easily solvable by denormalizing the type A to something like the following during unpacking:

data A =
  A1 Char |
  A2_1 Int |    -- from B1
  A2_2 Bool     -- from B2
Trac metadata
Trac field Value
Version 7.8.2
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