On 10 Aug 2007, at 6:42 am, David Roundy wrote:
do x1 <- e1
   if x1 then do x2 <- e2
                 xx <- if x2 then e3
                             else do x4 <- e4
                                     x5 <- e5
                                     e6 x4 x5
                 e7 xx x1
         else do x8 <- e8
                 x9 <- e9
                 e10 x8 x9 x1
   x11

Granted.  If you desugar nested dos then you need extra parentheses.
(Basically, the invisible curly braces turn visible as parentheses.)
But then, I don't regard this example as readable, and in true
"lots of little functions" style would name the steps.  I especially
dislike the irregular indentation one gets with do/if/do.

Anyone remember when Haskell extended list comprehension syntax to
monads?  Just as I was about to get my head around it, it went away.

This is the beauty of the do notation, it
allows one to write actual real complicated monadic code in a form
that is actually comprehensible.

It seems we are now in complete agreement except for "comprehensible".

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to