[Haskell-cafe] Re: On improving libraries: wanted list

John Goerzen jgoerzen at complete.org
Wed Dec 13 09:19:03 EST 2006


On Wed, Dec 13, 2006 at 04:19:58PM +1100, Donald Bruce Stewart wrote:
> > In particular, you seem to be wanting my pipeBoth function.
> > 
> > Note that your proposed String -> IO String function type is insufficient
> > because it does not provide a way to evaluate the return value of the
> > function.
> 
> this kind of functionality seems to be expected by new users (its one of
> the more common questions on #haskell). 
> 
> Is System.Cmd.Utils in a position to be moved into base alongside
> System.Cmd and System.Process? It seems quite fundamental for getting
> work done quickly for script-like haskell programs.

It could go under System.Posix perhaps.  It relies quite heavily on
functionality provided by the unix package and the System.Posix.* tree.

Take a look at the source at:

http://software.complete.org/missingh/browser/src/System/Cmd/Utils.hs

Only one function, safeSystem, is portable to Windows.  Also, because
Hugs doesn't support fork(), most aren't supported on Hugs, either.

I would be happy to contribute this to somewhere on the System.Posix
tree, or wherever it's most appropriate.

These functions take advantage of hslogger
(http://software.complete.org/hslogger), so you can use one line in your
main command to turn on command invocation debugging (see what commands
are started and what they return).  That will have to be stripped out
before it goes into base, which I'm willing to do.  (Or hslogger could
go into base, but I'm guessing there'd be objection to that.)

Comments?

Reminder for those just joining the thread, the API we're discussing is
http://software.complete.org/missingh/static/doc/System-Cmd-Utils.html

-- John


More information about the Haskell-Cafe mailing list