Here's my attempt (without a typechecker):
tryBogusSale = atomically populateWorld >>= \players@(alice:bob:_) ->
                       atomically (consistentBalance players >>= alwaysSucceeds) >> 
                       bogusSale Wand 5 alice bob

On Mon, Feb 23, 2009 at 9:33 AM, Michael Easter <codetojoy@gmail.com> wrote:

Folks,

I have an example of the do-syntax that I would like to desugar.  It is an example from Chapter 28 in RWH.

I think I understand the ideas behind the following STM example, but I would like to present it to others in a desugared way:

tryBogusSale = do
    players@(alice:bob:_) <- atomically populateWorld
    atomically $ alwaysSucceeds =<< consistentBalance players
    bogusSale Wand 5 alice bob

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.

thanks!
Michael

--
----------------------
Michael Easter
http://codetojoy.blogspot.com: Putting the thrill back in blog

http://youtube.com/ocitv -> Fun people doing serious software engineering

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners