do-Notation

anstatt
[ 1 .. 3 ] >>= \ x ->
     [ 1 .. x ] >>= \ y -> return (x*y)
schreibe
do { x <- [ 1 .. 3 ] 
   ; y <- [ 1 .. x ] 
   ; return (x*y) 
   }

(d. h. das Semikolon wird zu >>=)

durch Layout-Regel implizite Semikolons:

main = do 
    cs <- readFile "foo.bar"
    putStrLn cs



Johannes Waldmann 2007-06-21