Software Tools in Haskell: noop
exit successfully
Posted on 2016-02-08 by nbloomf
This page is part of a series on Software Tools in Haskell.
This post is literate Haskell; you can load the source into GHCi and play along.
As usual, we start with some imports.
One of the most important things a program can do is exit successfully when it is finished. This is what (all, really) that noop
does.
This program doesn’t compute anything, so in that sense it’s not much of a tool. But it does illustrate the basic structure of a Haskell program. The main
function is what gets executed when a program is run; everything else (parsing command line arguments, reading files, whatever) is done within main
. We signal that the program has exited successfully with the aptly-named exitSuccess
function.