Skip to content

UNPACK should allow recursion that obviously terminates

I want to do this:

{-# LANGUAGE TypeFamilies MagicHash KindSignatures #-}
data Peano = Zero | Succ Peano
data family BigWord (n :: Peano)
data instance BigWord Zero = MachineWord# Word#
data instance BigWord (Succ n) = BigWord {-# UNPACK #-}(BigWord n) {-# UNPACK #-}(BigWord n)

However, the compiler tells me that it is ignoring the UNPACKs, and the only reason I can see is that they are apparently recursive. This exact type of recursion is handled just fine in instance declarations because the recursive instance has fewer type constructors than the head; can't UNPACK do the same thing?

Trac metadata
Trac field Value
Version 8.0.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