
Hi,
On Thu, Jan 30, 2003 at 01:55:50PM -0000, Guest, Simon wrote:
I'm trying to make a backtracking state monad using Ralf Hinze's backtracking monad transformer. My problem is that it won't backtrack very far.
Suppose I try ( a >> b ) `mplus` c.
If b fails, it should try c, but it doesn't rewind past a.
Andrew Bromage wrote:
I've compared it with my own well-tested implementation and it seems identical modulo renamings.
The similarity is explained by the fact that I looked at your example on the Haskell Wiki as well as Ralf's paper, so thanks for that useful page.
In case you want to compare:
I will have a look at try to see what I am doing wrong.
I didn't follow the rest of the code, so I suspect the problem is elsewhere. One place to look is here:
-- backtracking state monad -- type NDSM st a = BACKTR (SM st) a
You may have meant to stack the monad transformers in a different order.
This bit I don't understand. I only have one monad transformer, which I use to transform my SM monad. I have an uneasy feeling that my observe is in the wrong place (passed to runSM), but again, I can't see what else I should have done. Thanks for the assurance, but I'm still head scratching for now. cheers, Simon