News for hackers. Stuff that matters.
Re:Use Haskell for shell scripting by Gabriel439 on Friday January 30, 2015 @10:29AM (#8972449)
Actually, you can do `grep -r` by just combining `grep` and `lstree`. Here's an example:

    example = do
        file <- lstree "some/dir"
        True <- liftIO (testfile file)
        grep "Some pattern" (input file)
This is an example of how most of Bash's option heavy ecosystem is an outgrowth of Bash's limitation as a language (individual commands accumulate flags to work around functionality difficult to implement within the Host language). I think having a decent host language decreases the need for so many configuration knobs for every command.
Re:Use Haskell for shell scripting by mercurial on Friday January 30, 2015 @11:14AM (#8972692)
You're right to some extent, but I think many of these 'knobs' have a good reason to exist (--dry-run, -a, -z for rsync for instance) and cannot be usefully, or at all, replaced by more composability. And attempting to implement support for them will run against the limitations of Haskell's syntax.

Something like OCaml would be better suited, since polymorphic variants, named and default arguments give a lot more flexibility, though the fact that shell commands happily return different outputs depending on their options would still be an issue.

Re:Use Haskell for shell scripting by sukilot on Saturday January 31, 2015 @12:03AM (#8975953)
Unix has

     find . -exec grep $pattern {} \;

but `grep -r` is easier to write.