Re: how about main :: IO Int

1997-08-26 Thread Fergus Henderson
Christian Sievers, you wrote: > Thank you for pointing me to the System library. However, while I was > indeed implying that there is no way of returning an exit code, my main > question was which type main should have. You seem not to like IO Int > (one even for several reasons ;-) but it still l

Re: how about main :: IO Int

1997-08-25 Thread Christian Sievers
Thank you for pointing me to the System library. However, while I was indeed implying that there is no way of returning an exit code, my main question was which type main should have. You seem not to like IO Int (one even for several reasons ;-) but it still looks quite natural to me. Christian

Re: RE: how about main :: IO Int

1997-08-22 Thread Lennart Augustsson
> Nope, returning from main is defined by the C standard to be equivalent > to calling exit(), as if main() where invoked as `exit(main(argc, argv))'. Well, it might be standardized, but I've been bitten by implementations that generate a random exit code if you just return 0 from main. This was

Re: RE: how about main :: IO Int

1997-08-22 Thread Lennart Augustsson
> Isn't this a Unix-specific convention, to treat the value returned by > main() > as the exit value of the process? Yes, and it only works in some flavours of Unix. The proper way to exit a C program is to call exit(). The proper way to exit a Haskell program is to call exitWith. -- L

Re: how about main :: IO Int

1997-08-22 Thread Thomas Hallgren
Christian Sievers wrote: > Hello, I just wondered if it was ever considered to let the main function > have the type IO Int, in order to let the haskell programm be able to > return an exit code to the calling environment, as C's int main(...) > does. I think real programms sometimes want to ex

Re: how about main :: IO Int

1997-08-22 Thread Kevin Hammond
Christian, In Haskell you can use exitWith :: ExitCode -> IO a from the System library, so you don't need the program to "return" a "Int" (this is not a esthetically pleasing in C!). The IO a allows the operation to be used in any IO monad context, not just IO (). Regards, Kevin At 6:40 pm 21/

RE: how about main :: IO Int

1997-08-21 Thread R.S. Nikhil
> From: Christian Sievers[SMTP:[EMAIL PROTECTED]] > Sent: Thursday, August 21, 1997 6:59 PM > To: [EMAIL PROTECTED] > Subject: how about main :: IO Int > > Hello, I just wondered if it was ever considered to let the main > function > have the type IO Int, in order to let