polysemy-http-0.7.0.0: Polysemy Effects for HTTP clients
Safe HaskellSafe-Inferred
LanguageHaskell2010

Polysemy.Http.Data.StreamEvent

Description

 
Synopsis

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.

Constructors

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.