[GHC] #9355: scanr does not participate in stream fusion

GHC ghc-devs at haskell.org
Thu Aug 7 23:17:55 UTC 2014


#9355: scanr does not participate in stream fusion
-------------------------------------+-------------------------------------
              Reporter:  dfeuer      |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:  7.8.4
             Component:              |          Version:  7.8.3
  libraries/base                     |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Moderate (less
  Unknown/Multiple                   |  than a day)
       Type of failure:  Runtime     |       Blocked By:
  performance bug                    |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Since `foldr` is strict in its list argument, I think it's then safe to go
 back to the pattern match style:

 {{{#!hs
 scanr f q0 = foldr go [q0] xs
   where
     go x qs@(q:_) = f x q : qs
 }}}

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


More information about the ghc-tickets mailing list