> And even better is
>> main = do
> cs <- strictReadFile "L:/Foo.txt"
> writeFile "L:/Foo.txt" cs
Yes. By making these mistakes I understand the problem very well now. But it
*is* hard to see if the function in question is strict or lazy.
For example, the problem to me appears to be that this code:
main = do
cs <- getLine
putStrLn ("Hello "++cs)
looks so much like
main = do
cs <- readFile "foo"
writeFile "foo" cs
but in the first one cs is strict, while the second it is lazy... But that's
not obvious. It would be if it looked like e.g:
main = do
cs <- getLine!
putStrLn! ("Hello "++cs)
or something similar.
Also, once I'm in the "do" syntax, my mind seems to switch to "imperative
mode", while of course, it is still purely functional code in desguise :)
Cheers,
Peter