Chad Scherrer wrote:
Is it possible to write a function

redirect :: Handle -> IO () -> IO ()

so that "redirect h action" is just like action, except that all the
output written to stdout now gets sent to h instead?

No. The file descriptor used for IO is wired into a Handle, just as in a FILE * in C. You can change where stdout points using hDuplicateTo, but that affects the entire process.

        <b
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to