#2754: Strictness analyzer fails on an implementation of foldl
--------------------------------------+-------------------------------------
Reporter: nimnul | Owner:
Type: run-time performance bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.8.3
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: x86
Os: Windows |
--------------------------------------+-------------------------------------
Comment (by dons):
nimul, this might explain the behaviour you see:
{{{
-- We write foldl as a non-recursive thing, so that it
-- can be inlined, and then (often) strictness-analysed,
-- and hence the classic space leak on foldl (+) 0 xs
foldl :: (a -> b -> a) -> a -> [b] -> a
foldl f z0 xs0 = lgo z0 xs0
where
lgo z [] = z
lgo z (x:xs) = lgo (f z x) xs
}}}
If I remember correctly from the discussion with nimul in #haskell, his
view was that the strictness analyser wasn't sufficiently powerful: it
doesn't do magic.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2754#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs