Re: problems with state-t monad transformer

2013-10-22 Thread Mark Fisher
The state modifications are both happening, if i inspect it after the 2nd function does an update the change is there, but the wind out of the return value from the first function is a different object, and immutability is giving me it before the 2nd update, which is a discarded object. I am se

Re: problems with state-t monad transformer

2013-10-22 Thread Ben Wolfson
based on what you posted to stack overflow I would guess it's because the side-effects (the prints) are coming too soon---you have a println as the first line of check-k-v, so if the expression (mplus (check-k-v ...) (check-k-v ...)) is evaluated, then, given that mplus is not a macro, both argumen

Re: problems with state-t monad transformer

2013-10-22 Thread Mark Fisher
It's difficult to see how it's a chunked issue, the original code is just calling monadic functions, the only map is the state (the latter part of my post was an attempt to manually recreate what the monad macros are doing and I'm sure i didn't do a perfect job of it). It's my understanding tha

Re: problems with state-t monad transformer

2013-10-22 Thread Sean Corfield
It sounds like you're running into the chunked sequence behavior of map (it's lazy but it realizes chunks of the sequence for efficiency rather than strictly on-demand). I'd say the possibilities are: don't use side-effecting functions in your monads or define a fully lazy version of map and defin

problems with state-t monad transformer

2013-10-22 Thread Mark Fisher
I originally posted this in Stack Overflow, but realised I might get more response from the google group. Apologies for duplication. I'm seeing some issues using a parser mon