Closed markandrus closed 11 years ago
That syntax looks good to me. In Haskell the same is written as:
do
a <- foo
if a == 10
then do
b <- bar
return b
else do
c <- quux
return c
Which is about the same sans curlies and brackets.
I'd like too see support for this common case too though:
$do {
a <- foo
if (a == 1) return bar else return quux
}
Do you see any problems in adding that too?
@jonifreeman Thanks for taking a look. I agree we should support the case you mentioned, and have since added it, as well as support for else if
s. Latest commit: faccfc5
Great! Please merge this to master whenever you like.
Merged: c46edaccd668c086cae7d5f30d7577c2df0114bd
@jonifreeman How should if/else be handled in do-notation? ae017ac22cc962d5f47c555f9afd06573c6af483 is one approach, but maybe a little noisy?