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

Polysemy.Http.Effect.Http

Description

 
Synopsis

Documentation

data Http c :: Effect where Source #

The main effect for HTTP requests. The parameter c determines the representation of raw chunks.

Constructors

Response :: Request -> (Response c -> m a) -> Http c m (Either HttpError a) 
Request :: Request -> Http c m (Either HttpError (Response LByteString)) 
Stream :: Request -> (Response c -> m a) -> Http c m (Either HttpError a) 
ConsumeChunk :: c -> Http c m (Either HttpError ByteString)

Internal action for streaming transfers.

response :: forall c r a. Member (Http c) r => Request -> (Response c -> Sem r a) -> Sem r (Either HttpError a) Source #

Bracket a higher-order action with a Response that has been opened while its body hasn't been fetched.

request :: forall c r. Member (Http c) r => Request -> Sem r (Either HttpError (Response LByteString)) Source #

Synchronously run an HTTP request and return the response.

stream :: forall c r a. Member (Http c) r => Request -> (Response c -> Sem r a) -> Sem r (Either HttpError a) Source #

Open a connection without consuming data and pass the response to a handler for custom transmission. The intended purpose is to allow streaming transfers.