[Haskell-cafe] "piping" to system call

Janis Voigtlaender voigt at tcs.inf.tu-dresden.de
Tue Sep 23 07:37:56 EDT 2008


assume I have a program taking input from stdin. How do I call it from
Haskell while feeding to it a string as input.

That is, I want a function like

   system' :: String -> String -> IO ExitCode

such that

   system' cmd inp

would be equivalent to first writing inp to a file, say "temp", and then

   system (cmd ++ " < temp")

Of course, without actually creating that temporary file and having to
clean it up afterwards.

Does such a system' exist?

Thanks, Janis.

Dr. Janis Voigtlaender
mailto:voigt at tcs.inf.tu-dresden.de

More information about the Haskell-Cafe mailing list