<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 20, 2015 at 12:09 PM, Cody Goodman <span dir="ltr"><<a href="mailto:codygman.consulting@gmail.com" target="_blank">codygman.consulting@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">type MyState = State Int<br><br>modAndPrintState :: Int -> MyState ()<br>modAndPrintState x = do<br>  get >>= \i -> do<br>    liftIO . print $ i<br>    if even x then put (x + i) else put (i * (x + 1) - x)<br></div></blockquote></div><br></div><div class="gmail_extra">This code works in the State monad and the only effect there is what it says on the tin: state, not IO. So the code gets use of put and get, but not print.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Others will soon chime in on StateT solutions, but from the looks of it, you merely want to display the trace of the state. In which case look to Debug.Trace.<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">-- Kim-Ee</div></div>
</div></div>