
24 Nov
2012
24 Nov
'12
1:12 p.m.
On Sat, Nov 24, 2012 at 5:52 AM, Nathan Hüsken
I have an example function in the list monad.
twoSucc :: Int -> [Int] twoSucc i = [i+1, i+2]
Now I want write something similar with the StateT monad transformer.
The simplest addition of StateT would look like this: twoSucc :: StateT () [] Int twoSucc i = lift [i+1, i+2]
twoSucc :: StateT Int [] () twoSucc = do i <- get put (i+1) -- how do I put [i+1,i+2] here?
In this transformation, you've moved your Int result from being the monadic result to being the stored state. I don't know which transformation you really want. -Karl