[Haskell] ANNOUNCE: h4sh - Haskell functions for shell scripting
Donald Bruce Stewart
dons at cse.unsw.edu.au
Sun Aug 14 02:22:18 EDT 2005
h4sh -- Haskell functions for shell scripting
Unix is all about programs that do one thing, and one thing well.
Unfortunately, over time, the common unix text processing commands have
become bloated and silly, with rather arbitrary features for programs
that should have simple semantics (consider uniq and wc outputting
leading space, or cut indexing fields from 1, just for starters). On the
other hand Haskell has a powerful and beautiful List library for
processing text as lists of strings.
h4sh exposes the Haskell List library as a set of shell utilities.
Utilising function composition via pipes, we can transparently program
in Haskell, in the shell :)
Commands are generated from a description of their type. Higher order
functions like map are handled using runtime evaluation, provided by the
hs-plugins System.Eval library, allowing arbitrary Haskell code to be
provided as arguments to, for example, map and filter.
A (contrived) example:
take -n 100 f | id | map -e show.length | filter -e '/= "0"' | sort | reverse | head
darcs get --partial http://www.cse.unsw.edu.au/~dons/code/h4sh
-- Don Stewart
More information about the Haskell