[GHC] #13825: Allow multiple constructor fields occupy the same word

GHC ghc-devs at haskell.org
Tue Jun 13 22:27:22 UTC 2017


#13825: Allow multiple constructor fields occupy the same word
-------------------------------------+-------------------------------------
        Reporter:  michalt           |                Owner:  michalt
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #605              |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by dfeuer):

 * related:   => #605
 * milestone:   => 8.4.1


Comment:

 `Bool` isn't special, and shouldn't be. It's just an enumeration type, and
 should remain one. #605 suggests representing unboxed enumeration types as
 `Int#`. It seems that to get what you want, you'd want to do something
 like what `Binary` and `Cereal` do with sum types, using a different
 number of bits depending on the number of constructors.

 One big question is whether and how to support sub-byte-sized fields. It
 is possible, presumably at some performance cost, to pack a `Bool` (for
 instance) into a single bit. Is the cost enough to worry about?

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


More information about the ghc-tickets mailing list