
6 Feb
2009
6 Feb
'09
1:34 p.m.
So if IO represents a program that when executed interacts with the world's state, is it safe to say that when I return (State Int Int), that I'm returning a "State program"? That'd make sense as it really does look like we force the State to be evaluated with runState, evalState or execState.
Yes, exactly.
The only difference with IO then is that to get IO programs to run, you have to do it inside another IO program.
Almost. Add to your mental model a "runIO" that is invoked when your program runs as: "runIO main". Your haskell compiler or interpretter arranges this for you as part of its contract with you.
I hope I'm not making this worse! :-)
I dont think so. Tim Newsham http://www.thenewsh.com/~newsham/