Bj|rn von Sydow ([EMAIL PROTECTED]) reports that this expression
runs in constant space
mapM_ putStr (repeat "")
but this program does not:
main = mapM_ putStr (repeat "")
This is caused by "CAF-leaks" - a long-standing problem of most Haskell
compilers (except HBC?). The problem is that main is being updated with
an expression of the form:
main = putChar ' ' >> putChar ' ' >> putChar ' ' >> mapM_ putStr (repeat "")
In the long term, we hope to avoid this kind of problem by using a smarter
garbage collector. In the short term, you can avoid the problem by making
the troublesome CAFs non-updateable. For example, you might rewrite
main as:
main _ = putChar ' ' >> putChar ' ' >> putChar ' ' >> mapM_ putStr (repeat "")
and then execute main ().
Action:
o I added the above to the known bugs list.
o The new runtime system will fix this problem.
The Hugs news page has some details of the new runtime system.
--
Alastair Reid Yale Haskell Project Hacker
[EMAIL PROTECTED] http://WWW.CS.Yale.EDU/homes/reid-alastair/