transient-0.1.0.8: A monad for extensible effects and primitives for unrestricted composability of applications

Safe HaskellNone
LanguageHaskell2010

Transient.Stream.Resource

Description

 

Synopsis

Documentation

sourceFile :: String -> TransIO String Source

slurp input from a file a line at a time. It creates as much threads as possible. to allow single threaded processing, use it with `threads 0`

sinkFile :: TransIO String -> String -> TransIO () Source

Stream the input to a file

process :: TransIO a -> IO handle -> (handle -> IO ()) -> (handle -> a -> TransIO (StreamData b)) -> TransIO b Source

is the general operation for processing a streamed input, with opening resources before processing and closing them when finish is called. The process statements suscribe to the EVar Finish.

when this variable is updated, the close section is called.

When the processing return SDone or SError, the Finish variable is updated so all the subscribed code that close the resources are executed.

finish :: TransIO () Source

trigger the event for the closing of all the resources

onFinish :: TransIO () -> TransIO a Source

suscribe a computation to be called when the finish event is triggered