GHC as a library - getting output from GHCI

Mads Lindstrøm mads_lindstroem at
Wed May 9 16:48:15 EDT 2007


Look at System.Posix.IO

I do not know if that module can do what you want. But it does deal with
FileDescriptors and handles.

Maybe the dup function can help you. According to it

"The dup implements the dup system call, which duplicates one desired
open file descriptor into another. This can be used connect standard
input or standard output to a pipe. This sample code shows how a parent
process can fork the standard Unix sort command and then feed it data to
be sorted. A simple extension would allow the child to write the results
back to the parent."

But I have not tested it yet, and I am not really familiar with Unix
inter-process communication.



Matthew Danish wrote:
> On Fri, May 04, 2007 at 08:12:55PM +0200, Pepe Iborra wrote:
> > Mads
> > 
> > On 04/05/2007, at 19:19, Mads Lindstr?m wrote:
> > 
> > >Hi Pepe
> > >
> > >I would have liked something cross-platform.
> > >
> > 
> > Take a look at the unix-compat[1] package by Bjorn Bringert, although  
> > it looks like it won't help you. Maybe it can be extended.
> > 
> I'm attempting to do the same thing.  But I don't see how wrapStmt can
> be implemented with System.Posix.Process.   Documentation doesn't seem
> to indicate any function that deals with Handles, or returns Strings.
> I am unfamiliar with that module however.

More information about the Glasgow-haskell-users mailing list