GHC as a library - getting output from GHCI

Simon Peyton-Jones simonpj at microsoft.com
Thu May 10 03:24:55 EDT 2007


| Also if stmt =
|
|     SomeModule.prettyPrinter "foobar"
|
| and SomeModule contains
|
|     prettyPrinter x = putStrLn $ "Pretty: " ++ x
|
| then the let binding will not catch it.

Indeed, that's exactly what I meant in my original msg. I have always thought it ugly that stdin and stdout are top-level definitions.  I want to be able to say

        withStdout :: Handle -> IO a -> IO a

so that (withStdout h a) runs 'a' but sends all std-out output to h.

Haskell should support this.  Starting a whole OS process to redirect stdout must surely be overkill!

(But maybe that is what you have to do today.)

S



More information about the Glasgow-haskell-users mailing list