[GHC] #9214: UNPACK support for sum types

GHC ghc-devs at haskell.org
Tue May 17 21:26:34 UTC 2016


#9214: UNPACK support for sum types
-------------------------------------+-------------------------------------
        Reporter:  mojojojo          |                Owner:  osa1
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1540
       Wiki Page:  UnpackedSumTypes  |  Phab:D1559
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 I'm just popping in to +1 this. Currently, `Data.IntMap` defines

 {{{#!hs
 data IntMap a = Bin ... !(IntMap a) !(IntMap a) | Tip ... | Nil
 }}}

 Logically, it *should* be

 {{{#!hs
 data IntMap a = IM !(IntMap1) | Nil
 data IntMap1 a = Bin ... !(IntMap1) !(IntMap1) | Tip ...
 }}}

 which would enforce the invariant that no `Nil`s can occur within a tree.
 But that has an extra indirection, which seems likely unacceptable. If we
 could `UNPACK` the `IntMap1` into the `IntMap`, we'd get the current
 performance with much nicer type guarantees.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9214#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list