List als Monade

instance Monad [] where
    return = \ x - > [x]
    m >>= f = case m of 
        []     -> [] 
        x : xs -> f x ++ ( xs >>= f )

do a <- [ 1 .. 4 ]
   b <- [ 2 .. 3 ]
   return ( a * b )



Johannes Waldmann 2012-01-30