I compiled the following program
-- Alice.hs
main = do
putStrLn "Hello"
l <- getLine
putStrLn $ "you said " ++ l
I want to communicate with Alice in another program: Bob.hs. My failed attempt is:
-- Bob.hs
import System.IO (hGetLine, hPutStrLn)
import System.Process (runInteractiveProcess)
main = do
(hin, hout, herr, ph) <- runInteractiveProcess "./Alice" [] Nothing Nothing
hello <- hGetLine hout
putStrLn hello
hPutStrLn hin "something"
reply <- hGetLine hout
putStrLn reply
Bob gets stuck before Hello is printed.