polysemy-process-0.9.0.0: Polysemy effects for system processes
Safe HaskellSafe-Inferred
LanguageHaskell2010

Polysemy.Process.Interpreter.ProcessOutput

Description

 
Synopsis

Documentation

interpretProcessOutputIgnore :: forall p a r. InterpreterFor (ProcessOutput p a) r Source #

Interpret ProcessOutput by discarding any output.

interpretProcessOutputId :: forall p r. InterpreterFor (ProcessOutput p ByteString) r Source #

Interpret ProcessOutput by immediately emitting raw ByteStrings without accumulation.

interpretProcessOutputLeft :: forall p a b r. Member (ProcessOutput p a) r => InterpreterFor (ProcessOutput p (Either a b)) r Source #

Transformer for ProcessOutput that lifts results into Left, creating 'ProcessOutput p (Either a b)' from 'ProcessOutput p a'.

interpretProcessOutputRight :: forall p a b r. Member (ProcessOutput p b) r => InterpreterFor (ProcessOutput p (Either a b)) r Source #

Transformer for ProcessOutput that lifts results into Right, creating 'ProcessOutput p (Either a b)' from 'ProcessOutput p b'.

interpretProcessOutputLines :: forall p r. InterpreterFor (ProcessOutput p ByteString) r Source #

Interpret ProcessOutput by emitting individual ByteString lines of output.

interpretProcessOutputText :: forall p r. InterpreterFor (ProcessOutput p Text) r Source #

Interpret ProcessOutput by immediately emitting Text without accumulation.

interpretProcessOutputTextLines :: forall p r. InterpreterFor (ProcessOutput p Text) r Source #

Interpret ProcessOutput by emitting individual Text lines of output.

parseMany :: Parser a -> Maybe (Parser a) -> ByteString -> (Maybe (Parser a), ([Either Text a], ByteString)) Source #

Internal helper for interpretProcessOutputIncremental that repeatedly parses elements from a chunk until the parser returns a failure or a partial result.

interpretProcessOutputIncremental :: forall p a r. (ByteString -> ProcessOutputParseResult a) -> InterpreterFor (ProcessOutput p (Either Text a)) r Source #

Whenever a chunk of output arrives, call the supplied incremental parser whose result must be converted to ProcessOutputParseResult. If a partial parse result is produced, it is stored in the state and resumed when the next chunk is available. If parsing an a succeeds, the parser recurses until it fails.