UNPACK polymorphic fields
ticket:3990#comment:56197 mentions the possibility of unpacking polymorphic fields. To quote:
[…]
What I mean by "polymorphic unpack" is this:
data Poly a = MkP Bool {-# UNPACK #-} a
data Mango = MkMango {-# UNPACK #-} (Poly Int)
Now a value of type Poly t would be represented using two pointer fields, as usual (ie the UNPACK would have no direct effect on Poly). But a Mango value would be represented thus:
data Mango = MkMangoRep Bool Int#
MkMango :: Poly Int -> MangoRep
MkMango (MkP b (I# i)) = MkMangoRep b i
-- Pattern match (MkMango p -> rhs)
-- is transformed to (MkMangoRep b i -> let p = MkP b (I# i) in rhs
Something like that would be rather nice. This ticket is just a reminder.
Thanks,[[br]] /Liyang
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | #3990 (closed) |
Blocking | |
CC | |
Operating system | |
Architecture |