Here's my attempt (without a typechecker):<div>tryBogusSale = atomically populateWorld >>= \players@(alice:bob:_) -></div><div> atomically (consistentBalance players >>= alwaysSucceeds) >> </div>
<div> bogusSale Wand 5 alice bob<br><br><div class="gmail_quote">On Mon, Feb 23, 2009 at 9:33 AM, Michael Easter <span dir="ltr"><<a href="mailto:codetojoy@gmail.com">codetojoy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br clear="all">Folks,<br><br>I have an example of the do-syntax that I would like to desugar. It is an example from Chapter 28 in RWH.<br>
<br>I think I understand the ideas behind the following STM example, but I would like to present it to others in a desugared way:<br>
<br>tryBogusSale = do<br> players@(alice:bob:_) <- atomically populateWorld<br> atomically $ alwaysSucceeds =<< consistentBalance players<br> bogusSale Wand 5 alice bob<br><br>I'm having problems especially with the 2nd line in the do block (i.e. the predicate for alwaysSucceeds). I would like to try and express this in terms of only bind (->) and return.<br>
<br>thanks!<br>Michael<br><font color="#888888"><br>-- <br>----------------------<br>Michael Easter<br><a href="http://codetojoy.blogspot.com" target="_blank">http://codetojoy.blogspot.com</a>: Putting the thrill back in blog<br>
<br><a href="http://youtube.com/ocitv" target="_blank">http://youtube.com/ocitv</a> -> Fun people doing serious software engineering<br>
</font><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>