HsUnix Features
- Command Line Arguments Parser
-
HsUnix has facilities for managing command line arguments, which are
(hopefully) easier to use than the GHC library GetOpt. Command line
arguments are described in lists of properties. HsUnix builds on top
of GetOpt, but hides it completely. Command line arguments handling
has been added because GetOpt was found to be too cumbersome.
-
Shell Like Commands
-
HsUnix has a growing list of front end functions for shell like
programming, such as chmod or mkdir. They wrap
calls to external programs, system calls or standard Haskell
functions.
-
Analyzing Paths
-
Dealing with paths is not as trivial as it sounds. Take, for example
../for///./../bar/. HsUnix has taken care of it thoroughly
and provides functions such as splitting a path into (real) path
components, or syntactically normalising paths.
-
Dealing with Processes and Calling External Programs
-
There are corresponding functions in the GHC Posix library, but
these are simpler.
-
Redirecting Input and Output
-
HsUnix defines operators like ->- and ->>-
which work just like redirection operators in shells.
-
Building Pipes
-
Reading the output of an external program, or piping the output of
one program into the input of another, is almost as easy as in
shells. HsUnix provides corresponding operators.
-
Error Handling
-
Error handling is one thing which is done much more thoroughly in
HsUnix than in shells. Failed programs won't be silently ignored.
Dynamic exceptions are used for error handling. Non zero exit codes
are thrown as exceptions.
-
Quoting of Strings and Building Commands for Shells
-
Taking care of shell metacharacters usually isn't done right. HsUnix
provides functions for doing so.