[GHC] #4937: Remove indirections caused by sum types, such as Maybe

GHC cvs-ghc at haskell.org
Tue Feb 1 16:20:47 CET 2011


#4937: Remove indirections caused by sum types, such as Maybe
---------------------------------+------------------------------------------
    Reporter:  tibbe             |        Owner:              
        Type:  feature request   |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  7.0.1       
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by rl):

 Not to detract from the discussion, but in this particular case, couldn't
 you do:

 {{{
 data Collection a = C (Array Bool) (Array a)
 }}}

 where the Bools indicate which of the elements are present and (Array a)
 either stores undefined for the missing elements (if you want O(1) random
 access) or doesn't contain the missing elements at all. You could try to
 improve performance by using a bit vector instead of an array of Bools.

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



More information about the Glasgow-haskell-bugs mailing list