[GHC] #5756: Specialize sequence into sequence_ automatically

GHC cvs-ghc at haskell.org
Sat Jan 7 17:14:40 CET 2012


#5756: Specialize sequence into sequence_ automatically
------------------------------+---------------------------------------------
 Reporter:  EyalLotem         |          Owner:                  
     Type:  feature request   |         Status:  new             
 Priority:  normal            |      Component:  Compiler        
  Version:  7.2.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 Currently, every function that has a useful "effect" as well as a
 potentially large result value, needs to get two implementations:  One
 that accumulates the result in memory and yields it, and one that avoids
 accumulating it in the first place.

 Some examples:

 sequence vs. sequence_

 mapM vs. mapM_

 Parsec's:  many vs. skipMany

 Now that I am writing parser combinators, I'm finding that I need a "skip"
 version of each parser I write, if my parser has a large value.

 If GHC can detect whether a value is eventually used, it could specialize
 sequence into sequence_ automatically, when it notices that the list is
 unused.

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



More information about the Glasgow-haskell-bugs mailing list