Checking for correct invocation of a command line haskell program

From HaskellWiki

thartman@linodehaskell:~/learning/haskell/UnixTools/arghandling>./args.sh
This demonstrates checking for correct invocation of a command line / shell haskell program
It runs a version which gives a "user friendly" error message when invoked incorrectly,
alongside an example of "ugly" argument checking that is slightly simpler to write,
but gives a less user friendly error message