#4936: Unbox sum types without fields
---------------------------------+------------------------------------------
    Reporter:  tibbe             |       Owner:              
        Type:  feature request   |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  7.0.1             |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 In the new I/O manager we use newtyped `Int`s instead of an ADT to squeeze
 out every drop of performance GHC can give us. It's a bit unfortunate that
 we have to make a choice between performance and safety here. Using an ADT
 have many benefits. For example, all possible values are grouped together
 neatly under the data type and the compiler can make sure we check all
 possible cases in case statements.

 Pointer tagging helps quite a bit here, if you have fewer than 4 (or 8)
 constructors. If you have more you don't get the benefit.

 Given a simple sum type like this:

 {{{
 data Color = Red | Green | Blue | Yellow
 }}}

 change its representation to an `Int`, allowing it to be unboxed into data
 types.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4936>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to