How can I get the result of the previous action and print it using >>=haskell?
In a shell, it looks like
echo "hello world" | { read test; echo test=$test; }
In haskell, I'm looking for something like
putStrLn "hello world" >>= {x <- getArgs; print x}
getArgs stdin should receive its data from putStrLn stdout.
Edit # 1, Alexey and aochagavia, thanks for your submissions. It works.
x :: IO String
x = return "hello world"
main = do
x >>= print
source
share