How to implement a transcript program in Haskell?

So you want to intercept writes to stdout, and to be able to write to stdin? Maybe there’s a way of doing that but it would probably be easier if you wrote the program to take two higher order arguments, say

myMain :: IO String -> (String -> IO ()) -> IO ()
myMain readIt writeIt = ...
1 Like