
18 Aug
2007
18 Aug
'07
12:07 p.m.
Hi Dan,
import Control.Monad.State
test = do put $ x+1 x <- return 1 return undefined
go = execState test undefined
I'd just like to point out that you can do something similar without mdo. For example, you can define a monad with newVar, readVar, and writeVar such that running the following results in 2. test = do x <- newVar y <- newVar valx <- readVar x writeVar y (valx+1) writeVar x 1 valy <- readVar y return valy (As you probably know, the previous two Monad.Reader issues include two different examples -- assembler and circuit description -- of circular programming in a monad.) Matt.