
On Tue, May 5, 2009 at 3:27 PM, Luke Palmer
On Sun, May 3, 2009 at 11:27 AM, Tobias Olausson
wrote: Hello! I have a program that is using ST.Strict, which works fine. However, the program needs to be extended, and to do that, lazy evaluation is needed. As a result of that, I have switched to ST.Lazy to be able to do stuff like
foo y = do x <- something xs <- foo (y+1) return (x:xs)
As Ryan points out, this will not do what you want. But that is incidental, not essential:
foo y = do x <- something fmap (x:) $ foo (y+1)
Questioning my own reasoning, I must apologize. I was wrong, these two programs are identical and both do what you want. Any references to the state *after* the infinite chain of foos will result in _|_, but as long as "something" is the only place that state calls occur, you will be fine. I also suspect that ST.Lazy should be no less defined than ST.Strict in all cases, modulo unsafe operations of course (you aren't doing those, are you?), so you have encountered a bug. Minimize the test case and submit a bug report :-) Luke