monad-http-0.1.0.0: A class of monads which can do http requests

Copyright(C) 2015 Futurice Oy
LicenseBSD-3-Clause
MaintainerOleg Grenrus <oleg.grenrus@iki.fi>
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Http.Class

Description

 

Synopsis

Documentation

class Monad m => MonadHttp m where Source

The monad capable to do HTTP requests.

Minimal complete definition

withResponse

Methods

withResponse :: Request -> (Response (BodyReaderM m) -> m a) -> m a Source

Get a single chunk of data from the response body, or an empty bytestring if no more data is available.

Note that in order to consume the entire request body, you will need to repeatedly call this function until you receive an empty ByteString as a result.

brRead :: BodyReaderM m -> m ByteString Source

Instances

httpLbs :: MonadHttp m => Request -> m (Response ByteString) Source

A convenience wrapper around withResponse which reads in the entire response body and immediately releases resources.

brConsume :: MonadHttp m => BodyReaderM m -> m [ByteString] Source

Strictly consume all remaining chunks of data from the stream.