Safe Haskell | None |
---|---|
Language | Haskell2010 |
- sourceFile :: String -> TransIO String
- sinkFile :: TransIO String -> String -> TransIO ()
- process :: TransIO a -> IO handle -> (handle -> FinishReason -> IO ()) -> (handle -> a -> TransIO (StreamData b)) -> TransIO b
- initFinish :: TransIO Finish
- finish :: FinishReason -> TransIO ()
- unFinish :: TransIO ()
- onFinish :: (FinishReason -> TransIO ()) -> TransIO ()
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`
:: TransIO a | input computation |
-> IO handle | open computation that gives resources to be used during the computation |
-> (handle -> FinishReason -> IO ()) | close computation that frees the resources |
-> (handle -> a -> TransIO (StreamData b)) | process to be done |
-> TransIO b |
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
Finish
EVar.
When this variable is updated, the close procedure is called.
When the processing return SDone
or SError
, the Finish
variable is updated so all the
subscribed code, that close the resources, is executed.
initFinish :: TransIO Finish Source #
initialize the event variable for finalization. all the following computations in different threads will share it
finish :: FinishReason -> TransIO () Source #
trigger the event, so this closes all the resources