How can I return success or failure to the operating system in Haskell?
The simplest Unix tools are true
and false
, little programs that do nothing but return 0 and开发者_Go百科 1 respectively to the operating system and exit. An example in C might look like the below:
// true - does nothing successfully
int main(void) {
return 0;
}
Through searching, I haven't been able to find a way to implement this kind of functionality in Haskell. Is there anything in the IO monad that can do this?
Use one of the functions defined in System.Exit.
See System.Exit.
There are a few exit
functions you should be able to use.
精彩评论