[Haskell-cafe] Re: [Haskell] Top Level <-

Curt Sampson cjs at starling-software.com
Sun Sep 7 21:02:21 EDT 2008

On 2008-08-28 14:45 -0700 (Thu), Jonathan Cast wrote:

> Now, I happen to know that the only top-level handles that can be
> established without issuing an open system call are
> stdin
> stdout
> stderr
> (unless you're happy to have your global nonStdErr start its life
> attached to an unopened FD).

I've not thought through exactly how this might relate to your argument,
but certainly, though there might or might not be Haskell Handles for
other file descriptors, they can start out open without calling open.
Compile this simple program:

    #import <stdio.h>

    int main() {
	int n;
	n = write(5, "foobar\n", 7);
	printf("write returned %d\n", n);
	return 0;

and run it with "./a.out 5>&1" and have a look at the result you get.

Curt Sampson       <cjs at starling-software.com>        +81 90 7737 2974   
Mobile sites and software consulting: http://www.starling-software.com

More information about the Haskell-Cafe mailing list