[Haskell] writing a shell in Haskell

Norman Ramsey nr at cs.tufts.edu
Tue Jan 13 22:50:32 EST 2009

As a demo for the first day of class, I thought I'd try to write a
simple shell in Haskell, in part so I can show algebraic data types
and monads on the first day, but also to convince potential skeptics
that functional languages can do systemsy things.

All the usual functional stuff is going very nicely, but I don't seem
to be able to get my hands on pipe(2) at all, and the language in the
documentation for fork() and exec() might as well read Here Be Dragons.

Looking for ways to fork, it appears that I have a wealth of
abstractions to choose from: 


The 'new' System.Process on the web appears to have some very nice
facilities, although it is still not strong enough to do what I want
cleanly (capture the output from a command that might be internal or
might require me to fork an external process).  However, the question
is moot because my system seems to have a consistent set of libraries
coordinate with the release of GHC 6.8, and I don't know how to put
together a consistent set of 'new' libraries to go with 6.10.  
(I don't even know if such a set exists.)

Please advise me: should I give up the idea of writing a shell using
GHC and the classic Unix system calls fork/exec/close/pipe?
Or if it is possible after all, in what module should I be looking for
the proper abstractions?


More information about the Haskell mailing list