[GHC] #9214: UNPACK support for sum types

GHC ghc-devs at haskell.org
Wed May 18 14:44:27 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):

 One special case is a GADT with one constructor that takes one argument
 without any class context. For instance

 {{{#!hs
 data Foo a = This a | That a a
 data Bar a b where
   Bar :: !(Foo a) -> Bar a a
 data Baz where
   Baz :: !(Foo a) -> Baz
 }}}

 It would be great to be able to unpack `Foo` into `Bar` and `Baz`.
 Matching on the `Bar` or `Baz` constructor would force its contents to
 WHNF and reveal the evidence/open the existential.

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


More information about the ghc-tickets mailing list