
#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 nomeata): Staring at this case a bit more, I conclude that we will never get good code from fusing a higher order foldr (like `foldl` or `take` or anything with an accumulating parameter) with a cyclic producer. It will sucessfully tie the know, but a knot of type `Int# -> Int` (and we can see this happening here). So it will create 5 function closures of that type that call each other in a round-robin style; the pattern match on the list elements happens only once. And I as there is no way to pull the accumulating argument into the knot (after all, it changes while going round the circle), this can hardly be avoided. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9398#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler