[Haskell-beginners] desugaring an example from RWH

Michael Easter codetojoy at gmail.com
Mon Feb 23 09:33:40 EST 2009


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.


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

http://youtube.com/ocitv -> Fun people doing serious software engineering
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090223/ed207ffd/attachment.htm

More information about the Beginners mailing list