Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I return success or failure to the operating system in Haskell?

Tags:

io

haskell

errno

The simplest Unix tools are true and false, little programs that do nothing but return 0 and 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?

like image 822
Ian Gilham Avatar asked Nov 29 '22 10:11

Ian Gilham


2 Answers

Use one of the functions defined in System.Exit.

like image 73
Cat Plus Plus Avatar answered Dec 04 '22 08:12

Cat Plus Plus


See System.Exit.

like image 38
alternative Avatar answered Dec 04 '22 09:12

alternative