Calling an external command from a Haskell program

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Tue Oct 21 12:29:27 EDT 2003


> I already knew about 'system' in
> library System, but the Hugs installation says:
>
> -- Warning: the implementation of these functions in Hugs 98 is very weak.
> -- The functions themselves are best suited to uses in compiled programs,
> -- and not to use in an interpreter-based environment like Hugs.

This warning is (rather carelessly) applied to the entire module when, in 
fact, it only applies to getArgs and getProgName when used in an interpretive 
environment (i.e., hugs but not runhugs).

The error message isa also a bit misleading since the problem lies not in the 
implementation but in choosing a sensible semantics for these functions when 
there is no ProgName and no Args.

The function getEnv works fine in Hugs.

The function system works fine in Hugs except on windows where DOS limitations 
cause the function to always return ExitSuccess.  (ghc suffers from the same 
problem on Windows.)

--
Alastair Reid     www.haskell-consulting.com



More information about the Haskell mailing list