process-listlike-0.9: Enhanced version of process-extras

Safe HaskellNone

System.Process.Chunks

Contents

Synopsis

Documentation

data Chunk a Source

The output stream of a process returned by readProcessChunks.

Constructors

ProcessHandle ProcessHandle

This will always come first

Stdout a 
Stderr a 
Exception IOError 
Result ExitCode 

Instances

Show a => Show (Chunk a) 

readProcessChunks :: ListLikePlus a c => CreateProcess -> a -> IO [Chunk a]Source

A concrete use of readProcessInterleaved - build a list containing chunks of process output, any exceptions that get thrown (unimplemented), and finally an exit code.

Control

foldChunk :: (ProcessHandle -> b) -> (a -> b) -> (a -> b) -> (IOError -> b) -> (ExitCode -> b) -> Chunk a -> bSource

foldChunks :: (r -> Chunk a -> r) -> r -> [Chunk a] -> rSource

Build a value from a chunk stream.

putChunk :: ListLikePlus a c => Chunk a -> IO ()Source

Write the Stdout chunks to stdout and the Stderr chunks to stderr.

Canonical

canonicalChunks :: ListLikePlus a c => [Chunk a] -> [Chunk a]Source

Merge adjacent Stdout or Stderr chunks.

Indent

indentChunks :: (ListLikePlus a c, Eq c) => c -> a -> a -> [Chunk a] -> [Chunk a]Source

Pure function to indent the text of a chunk list.

putIndented :: (ListLikePlus a c, Eq c) => c -> a -> a -> [Chunk a] -> IO [Chunk a]Source

Output the indented text of a chunk list, but return the original unindented list.

Dotify

dotifyChunk :: forall a c m. (Monad m, Functor m, ListLikePlus a c) => Int -> c -> Chunk a -> StateT Int m [Chunk a]Source

dotifyChunks :: forall a c. ListLikePlus a c => Int -> c -> [Chunk a] -> [Chunk a]Source

putDots :: ListLikePlus a c => Int -> c -> [Chunk a] -> IO [Chunk a]Source

Output the dotified text of a chunk list, but return the original unindented list.