Problem with backtracking monad transformer

Guest, Simon simon.guest@roke.co.uk
Fri, 31 Jan 2003 09:05:11 -0000


This is a multi-part message in MIME format.

--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain;
	charset="iso-8859-1"

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:
> 
> 	http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/hfl/hfl/mtl/

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

--------------InterScan_NT_MIME_Boundary
Content-Type: text/plain;
	name="RMRL-Disclaimer.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="RMRL-Disclaimer.txt"

Registered Office: Roke Manor Research Ltd, Siemens House, Oldbury, Bracknell, 
Berkshire. RG12 8FZ

The information contained in this e-mail and any attachments is confidential to Roke 

Manor Research Ltd and must not be passed to any third party without permission. This 

communication is for information only and shall not create or change any contractual 

relationship.

--------------InterScan_NT_MIME_Boundary--