31 Aug
2007
31 Aug
'07
1:08 a.m.
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? Thanks, Chad
31 Aug
31 Aug
1:55 a.m.
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.
6706
Age (days ago)
6706
Last active (days ago)
1 comments
2 participants
participants (2)
-
Bryan O'Sullivan -
Chad Scherrer