id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
7647,UNPACK polymorphic fields,liyang,simonpj,"comment:9:ticket:3990 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",feature request,new,normal,7.8.1,Compiler,7.6.1,,,hackage.haskell.org@…,Unknown/Multiple,Unknown/Multiple,Runtime performance bug,Unknown,,,,3990
