streaming-commons- Common lower-level functions needed by various streaming data libraries

Safe HaskellSafe-Inferred




A full tutorial for this module is available on FP School of Haskell:

Note that, while the tutorial covers Data.Streaming.Process, this module is the basis of the streaming version, and almost all concepts there apply here.



streamingProcess :: (MonadIO m, InputSource stdin, OutputSink stdout, OutputSink stderr) => CreateProcess -> m (stdin, stdout, stderr, StreamingProcessHandle)Source

The primary function for running a process. Note that, with the exception of UseProvidedHandle, the values for std_in, std_out and std_err will be ignored by this function.

Since 0.1.4

Specialized streaming types

data Inherited Source

Inherit the stream from the current process.

Since 0.1.4



data ClosedStream Source

Close the stream with the child process.

Since 0.1.4



data UseProvidedHandle Source

Use the Handle provided by the CreateProcess value. This would allow you, for example, to open up a Handle to a file, set it as std_out, and avoid any additional overhead of dealing with providing that data to your process.

Since 0.1.4



Process handle

data StreamingProcessHandle Source

Wraps up the standard ProcessHandle to avoid the waitForProcess deadlock. See the linked documentation from the module header for more information.

Since 0.1.4

waitForStreamingProcess :: MonadIO m => StreamingProcessHandle -> m ExitCodeSource

Blocking call to wait for a process to exit.

Since 0.1.4

waitForStreamingProcessSTM :: StreamingProcessHandle -> STM ExitCodeSource

STM version of waitForStreamingProcess.

Since 0.1.4

getStreamingProcessExitCode :: MonadIO m => StreamingProcessHandle -> m (Maybe ExitCode)Source

Non-blocking call to check for a process exit code.

Since 0.1.4

getStreamingProcessExitCodeSTM :: StreamingProcessHandle -> STM (Maybe ExitCode)Source

STM version of getStreamingProcessExitCode.

Since 0.1.4

streamingProcessHandleRaw :: StreamingProcessHandle -> ProcessHandleSource

Get the raw ProcessHandle from a StreamingProcessHandle. Note that you should avoid using this to get the process exit code, and instead use the provided functions.

Since 0.1.4

streamingProcessHandleTMVar :: StreamingProcessHandle -> TMVar ExitCodeSource

Get the TMVar storing the process exit code. In general, one of the above functions should be used instead to avoid accidentally corrupting the variable's state..

Since 0.1.4

Type classes

class InputSource a Source

Class for all things which can be used to provide standard input.

Since 0.1.4

class OutputSink a Source

Class for all things which can be used to consume standard output or error.

Since 0.1.4