[GHC] #9356: scanl does not participate in stream fusion

GHC ghc-devs at haskell.org
Mon Sep 1 05:12:37 UTC 2014


#9356: scanl does not participate in stream fusion
-------------------------------------+-------------------------------------
              Reporter:  dfeuer      |            Owner:
                  Type:  bug         |           Status:  patch
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:  Runtime     |       Blocked By:
  performance bug                    |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 There is some kind of bad interaction that makes `sum . concat . inits $
 [1..10000]` explode (use tons of RAM) when `inits` is written using a
 `scanl'` similar to this `scanl`. If this is affected, it may not be ready
 to go after all. I can fix the problem by breaking the pipeline between
 `concat` and `inits`; there also isn't a problem if I drop the `sum`. If I
 use `foldl' (+) 0` instead of `sum`, then it doesn't explode anymore, but
 it still allocates excessively and runs slowly.

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


More information about the ghc-tickets mailing list