[Haskell] ANNOUNCE: HsUnix 1.0.1 - Haskell for Unix Shell Scripting
post at volker-wysk.de
Sun Feb 8 21:36:16 EST 2004
I'm pleased to announce the first release of the HsUnix library. It
enables you to do things easily in Haskell which are typically done by the
shell. Thus Haskell can be used to write shell scripts.
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.
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
the ones here are simpler.
Redirecting Input and Output
HsUnix defines operators like ->- and ->>- which work just like
redirection operators in shells.
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 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 it safely.
Volker Wysk <post at volker-wysk.de>
More information about the Haskell