[GHC] #9398: Data.List.cycle is not a good producer

GHC ghc-devs at haskell.org
Sun Aug 3 19:18:46 UTC 2014


#9398: Data.List.cycle is not a good producer
-------------------------------------+-------------------------------------
              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:  Easy (less than 1
  Unknown/Multiple                   |  hour)
       Type of failure:  Runtime     |       Blocked By:
  performance bug                    |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Replying to [comment:3 nomeata]:
 > Remember that GHC doesn’t inline recursive things (such as `cyc`).
 >
 > Also, I don’t think your `cycle` is a good consumer: To inline it, you
 need to know that its argument is a `:`. But to make it a good consumer,
 the argument needs to be of the shape `build ...`.

 I suppose I should (try to) find a way to rewrite it to another form if it
 doesn't get eaten by foldr. I'm not understanding your concern about the
 consumption side. `cyc` isn't inlined, but the enclosing `cycle` is.
 Shouldn't that be good enough to allow the `foldr` in `cycle'` to fuse
 with a `build` or `augment` in `xs`?

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


More information about the ghc-tickets mailing list