| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Effectful.HTTP.Client.Dynamic
Description
Provides dynamic network effects.
Since: 0.1
Synopsis
- data Network (a :: Type -> Type) b where
- NewManager :: forall (a :: Type -> Type). ManagerSettings -> Network a Manager
- NewTlsManager :: forall (a :: Type -> Type). Network a Manager
- NewTlsManagerWith :: forall (a :: Type -> Type). ManagerSettings -> Network a Manager
- ApplyDigestAuth :: forall (a :: Type -> Type) (n :: Type -> Type). MonadThrow n => ByteString -> ByteString -> Request -> Manager -> Network a (n Request)
- WithResponse :: forall (a :: Type -> Type) b. Request -> Manager -> (Response (BodyReader a) -> a b) -> Network a b
- WithResponseHistory :: forall (a :: Type -> Type) b. Request -> Manager -> (HistoriedResponse (BodyReader a) -> a b) -> Network a b
- BrRead :: forall (a :: Type -> Type). BodyReader a -> Network a ByteString
- BrReadSome :: forall (a :: Type -> Type). BodyReader a -> Int -> Network a ByteString
- BrConsume :: forall (a :: Type -> Type). BodyReader a -> Network a [ByteString]
- runNetwork :: forall a (es :: [Effect]). (HasCallStack, IOE :> es) => Eff (Network ': es) a -> Eff es a
- newManager :: forall (es :: [Effect]). (HasCallStack, Network :> es) => ManagerSettings -> Eff es Manager
- newTlsManager :: forall (es :: [Effect]). (HasCallStack, Network :> es) => Eff es Manager
- newTlsManagerWith :: forall (es :: [Effect]). (HasCallStack, Network :> es) => ManagerSettings -> Eff es Manager
- applyDigestAuth :: forall n (es :: [Effect]). (HasCallStack, MonadThrow n, Network :> es) => ByteString -> ByteString -> Request -> Manager -> Eff es (n Request)
- type BodyReader (m :: Type -> k) = m ByteString
- withResponse :: forall a (es :: [Effect]). (HasCallStack, Network :> es) => Request -> Manager -> (Response (BodyReader (Eff es)) -> Eff es a) -> Eff es a
- withResponseHistory :: forall a (es :: [Effect]). (HasCallStack, Network :> es) => Request -> Manager -> (HistoriedResponse (BodyReader (Eff es)) -> Eff es a) -> Eff es a
- brRead :: forall (es :: [Effect]). (HasCallStack, Network :> es) => BodyReader (Eff es) -> Eff es ByteString
- brReadSome :: forall (es :: [Effect]). (HasCallStack, Network :> es) => BodyReader (Eff es) -> Int -> Eff es LazyByteString
- brConsume :: forall (es :: [Effect]). (HasCallStack, Network :> es) => BodyReader (Eff es) -> Eff es [ByteString]
- readResponseJson :: forall a (es :: [Effect]). (FromJSON a, HasCallStack, Network :> es) => String -> Response (BodyReader (Eff es)) -> Eff es a
- readResponseUtf8 :: forall (es :: [Effect]). (HasCallStack, Network :> es) => String -> Response (BodyReader (Eff es)) -> Eff es Text
- readResponse :: forall a (es :: [Effect]). (HasCallStack, Network :> es) => String -> Response (BodyReader (Eff es)) -> (BodyReader (Eff es) -> Eff es a) -> Eff es a
- data NetworkStatusE = MkNetworkStatusE String Status
- data NetworkReadBodyE = MkNetworkReadBodyE String SomeException
- data NetworkDecodeUtf8E = MkNetworkDecodeUtf8E ByteString UnicodeException
- data NetworkDecodeJsonE = MkNetworkDecodeJsonE ByteString String
- data ManagerSettings
- data Manager
- data Request
- data Response body
Effect
data Network (a :: Type -> Type) b where Source #
Dynamic effect for network effects.
Since: 0.1
Constructors
| NewManager :: forall (a :: Type -> Type). ManagerSettings -> Network a Manager | |
| NewTlsManager :: forall (a :: Type -> Type). Network a Manager | |
| NewTlsManagerWith :: forall (a :: Type -> Type). ManagerSettings -> Network a Manager | |
| ApplyDigestAuth :: forall (a :: Type -> Type) (n :: Type -> Type). MonadThrow n => ByteString -> ByteString -> Request -> Manager -> Network a (n Request) | |
| WithResponse :: forall (a :: Type -> Type) b. Request -> Manager -> (Response (BodyReader a) -> a b) -> Network a b | |
| WithResponseHistory :: forall (a :: Type -> Type) b. Request -> Manager -> (HistoriedResponse (BodyReader a) -> a b) -> Network a b | |
| BrRead :: forall (a :: Type -> Type). BodyReader a -> Network a ByteString | |
| BrReadSome :: forall (a :: Type -> Type). BodyReader a -> Int -> Network a ByteString | |
| BrConsume :: forall (a :: Type -> Type). BodyReader a -> Network a [ByteString] |
Instances
| ShowEffect Network Source # | Since: 0.1 |
Defined in Effectful.HTTP.Client.Dynamic | |
| type DispatchOf Network Source # | Since: 0.1 |
Defined in Effectful.HTTP.Client.Dynamic | |
Handlers
Manager
Arguments
| :: forall (es :: [Effect]). (HasCallStack, Network :> es) | |
| => ManagerSettings | . |
| -> Eff es Manager |
Since: 0.1
TLS
Since: 0.1
Arguments
| :: forall (es :: [Effect]). (HasCallStack, Network :> es) | |
| => ManagerSettings | . |
| -> Eff es Manager |
Since: 0.1
Arguments
| :: forall n (es :: [Effect]). (HasCallStack, MonadThrow n, Network :> es) | |
| => ByteString | . |
| -> ByteString | |
| -> Request | |
| -> Manager | |
| -> Eff es (n Request) |
Since: 0.1
Queries
type BodyReader (m :: Type -> k) = m ByteString Source #
Since: 0.1
Arguments
| :: forall a (es :: [Effect]). (HasCallStack, Network :> es) | |
| => Request | . |
| -> Manager | |
| -> (Response (BodyReader (Eff es)) -> Eff es a) | |
| -> Eff es a |
Since: 0.1
Arguments
| :: forall a (es :: [Effect]). (HasCallStack, Network :> es) | |
| => Request | . |
| -> Manager | |
| -> (HistoriedResponse (BodyReader (Eff es)) -> Eff es a) | |
| -> Eff es a |
Since: 0.1
Consumers
Arguments
| :: forall (es :: [Effect]). (HasCallStack, Network :> es) | |
| => BodyReader (Eff es) | . |
| -> Eff es ByteString |
Since: 0.1
Arguments
| :: forall (es :: [Effect]). (HasCallStack, Network :> es) | |
| => BodyReader (Eff es) | . |
| -> Int | |
| -> Eff es LazyByteString |
Since: 0.1
Arguments
| :: forall (es :: [Effect]). (HasCallStack, Network :> es) | |
| => BodyReader (Eff es) | . |
| -> Eff es [ByteString] |
Since: 0.1
Helpers
Arguments
| :: forall a (es :: [Effect]). (FromJSON a, HasCallStack, Network :> es) | |
| => String | String url. |
| -> Response (BodyReader (Eff es)) | Response. |
| -> Eff es a |
Helper for reading a response, decoding JSON.
Arguments
| :: forall (es :: [Effect]). (HasCallStack, Network :> es) | |
| => String | String url. |
| -> Response (BodyReader (Eff es)) | Response. |
| -> Eff es Text |
Helper for reading a response, decoding to UTF-8.
Since: 0.1
Arguments
| :: forall a (es :: [Effect]). (HasCallStack, Network :> es) | |
| => String | String url. |
| -> Response (BodyReader (Eff es)) | Response. |
| -> (BodyReader (Eff es) -> Eff es a) | Consumer. |
| -> Eff es a |
Helper for reading a response, checking for status 200 and exceptions thrown by the consumer.
Since: 0.1
Exceptions
data NetworkStatusE Source #
Constructors
| MkNetworkStatusE String Status |
Instances
| Exception NetworkStatusE Source # | |
Defined in Effectful.HTTP.Client.Internal Methods toException :: NetworkStatusE -> SomeException # fromException :: SomeException -> Maybe NetworkStatusE # displayException :: NetworkStatusE -> String # backtraceDesired :: NetworkStatusE -> Bool # | |
| Show NetworkStatusE Source # | |
Defined in Effectful.HTTP.Client.Internal Methods showsPrec :: Int -> NetworkStatusE -> ShowS # show :: NetworkStatusE -> String # showList :: [NetworkStatusE] -> ShowS # | |
data NetworkReadBodyE Source #
Constructors
| MkNetworkReadBodyE String SomeException |
Instances
| Exception NetworkReadBodyE Source # | |
Defined in Effectful.HTTP.Client.Internal Methods toException :: NetworkReadBodyE -> SomeException # fromException :: SomeException -> Maybe NetworkReadBodyE # | |
| Show NetworkReadBodyE Source # | |
Defined in Effectful.HTTP.Client.Internal Methods showsPrec :: Int -> NetworkReadBodyE -> ShowS # show :: NetworkReadBodyE -> String # showList :: [NetworkReadBodyE] -> ShowS # | |
data NetworkDecodeUtf8E Source #
Constructors
| MkNetworkDecodeUtf8E ByteString UnicodeException |
Instances
| Exception NetworkDecodeUtf8E Source # | |
Defined in Effectful.HTTP.Client.Internal Methods toException :: NetworkDecodeUtf8E -> SomeException # fromException :: SomeException -> Maybe NetworkDecodeUtf8E # | |
| Show NetworkDecodeUtf8E Source # | |
Defined in Effectful.HTTP.Client.Internal Methods showsPrec :: Int -> NetworkDecodeUtf8E -> ShowS # show :: NetworkDecodeUtf8E -> String # showList :: [NetworkDecodeUtf8E] -> ShowS # | |
data NetworkDecodeJsonE Source #
Constructors
| MkNetworkDecodeJsonE ByteString String |
Instances
| Exception NetworkDecodeJsonE Source # | |
Defined in Effectful.HTTP.Client.Internal Methods toException :: NetworkDecodeJsonE -> SomeException # fromException :: SomeException -> Maybe NetworkDecodeJsonE # | |
| Show NetworkDecodeJsonE Source # | |
Defined in Effectful.HTTP.Client.Internal Methods showsPrec :: Int -> NetworkDecodeJsonE -> ShowS # show :: NetworkDecodeJsonE -> String # showList :: [NetworkDecodeJsonE] -> ShowS # | |
Re-exports
data ManagerSettings Source #
Settings for a Manager. Please use the defaultManagerSettings function and then modify
individual settings. For more information, see http://www.yesodweb.com/book/settings-types.
Since 0.1.0
Keeps track of open connections for keep-alive.
If possible, you should share a single Manager between multiple threads and requests.
Since 0.1.0
Instances
| HasHttpManager Manager Source # | |
Defined in Network.HTTP.Client.Types Methods getHttpManager :: Manager -> Manager Source # | |
All information on how to connect to a host and what should be sent in the HTTP request.
If you simply wish to download from a URL, see parseRequest.
The constructor for this data type is not exposed. Instead, you should use
either the defaultRequest value, or parseRequest to
construct from a URL, and then use the records below to make modifications.
This approach allows http-client to add configuration options without
breaking backwards compatibility.
For example, to construct a POST request, you could do something like:
initReq <- parseRequest "http://www.example.com/path"
let req = initReq
{ method = "POST"
}For more information, please see http://www.yesodweb.com/book/settings-types.
Since 0.1.0
Instances
| IsString Request Source # | Parses a URL via NOTE: Prior to version 0.5.0, this instance used |
Defined in Network.HTTP.Client.Request Methods fromString :: String -> Request # | |
| Show Request Source # | |
A simple representation of the HTTP response.
Since 0.1.0
Instances
| Functor Response Source # | |
| Foldable Response Source # | |
Defined in Network.HTTP.Client.Types Methods fold :: Monoid m => Response m -> m # foldMap :: Monoid m => (a -> m) -> Response a -> m # foldMap' :: Monoid m => (a -> m) -> Response a -> m # foldr :: (a -> b -> b) -> b -> Response a -> b # foldr' :: (a -> b -> b) -> b -> Response a -> b # foldl :: (b -> a -> b) -> b -> Response a -> b # foldl' :: (b -> a -> b) -> b -> Response a -> b # foldr1 :: (a -> a -> a) -> Response a -> a # foldl1 :: (a -> a -> a) -> Response a -> a # elem :: Eq a => a -> Response a -> Bool # maximum :: Ord a => Response a -> a # minimum :: Ord a => Response a -> a # | |
| Traversable Response Source # | |
Defined in Network.HTTP.Client.Types | |
| Show body => Show (Response body) Source # | |