Luke Palmer wrote:
Using this you can do more complex actions, like, for instance, adding
two numbers:
readLine >>= (\x -> readLine >>= (\y -> print (x + y)))
Take a moment to grok that...
Which you might like to write:
do x <- readLine
y <- readLine
print (x + y)
you can leave out the parentheses and make it similarly readable, still
without "do" (at least, readable once you get used to the style, which
might look almost as weird as do-notation)
readLine >>= \x ->
readLine >>= \y ->
print (x + y)
Isaac
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe