[Haskell-cafe] develop new Haskell shell?
Brian Hulley
brianh at metamilk.com
Fri May 12 09:59:16 EDT 2006
Jeremy Shaw wrote:
> At Thu, 11 May 2006 23:05:14 +0100,
> Brian Hulley wrote:
>
>> Of course the above could no doubt be improved but surely it is
>> already far easier to understand and much more powerful than the
>> idiosyncratic text based approach used in UNIX shells (including rc).
>
> The idea of representing unix pipes as monads has been around for a
> while -- but what most people fail to account for is that many (most?)
> real-world shell scripts also need to deal with return values and
> stderr. Even standard unix shells are pretty terrible in this regard
> -- so if we could do it *better* than standard shells -- that could be
> pretty compelling.
> [snip lots of examples and other interesting points]
Some other possibilities are:
1) Every command returns a pair consisting of result and return code
2) Use exceptions instead of stderr
3) Use a more complicated monad
> It may still be a good idea to take the top 20 unix utils and code
> them as native haskell functions and see how far that goes. I know
> there are some existing libraries that deal with basic stuff like mv,
> etc. Has anyone implemented grep, find, etc?
This is also how I would start because it would allow all the control flow/
ease of use issues to be explored just using GHCi / Hugs etc before tackling
the problem of how to get binaries to interface with the shell.
Regards, Brian.
More information about the Haskell-Cafe
mailing list