Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data StreamEvent r c h a where
- Acquire :: Response c -> StreamEvent r c h h
- Chunk :: h -> StreamChunk -> StreamEvent r c h ()
- Result :: Response c -> h -> StreamEvent r c h r
- Release :: h -> StreamEvent r c h ()
Documentation
data StreamEvent r c h a where Source #
Control algebra for streaming requests.
r
is the final return type of the stream handler, after the request is processed to completion.
c
is the raw chunk data type
h
is the handle type that identifies the active request. It is entirely controlled by the consumer and may be
empty.
Acquire :: Response c -> StreamEvent r c h h | Used when calling the handler after the request has been initiated, but no data has been read. |
Chunk :: h -> StreamChunk -> StreamEvent r c h () | Used when calling the handler for each received chunk. |
Result :: Response c -> h -> StreamEvent r c h r | Used when calling the handler after the request has finished transferring. It should return the final result. |
Release :: h -> StreamEvent r c h () | Used to finalize the transfer, e.g. for resource cleanup. |