// of type B. ">>=" instead takes in something of type M[A],
// a function from (A -> B) and produces something of type
// M[B].
The type of ">>=" is M a -> (a -> M b) -> M b, which lets you 'chain' the result of one monadic function (a -> M b) to another monadic function. So, for example:
return :: String -> IO String
putStrLn :: String -> IO ()
getLine :: IO String
return "foo" >>= putStrLn :: IO () -- prints "foo"
getLine >>= putStrLn :: IO () -- gets a line of input, then prints it
Oops, yeah, the map function above composes its argument with return, giving it the type M a -> (a -> b) -> M b, making it equivalent to the Haskell `liftm` function.