Copyright | (c) 2019-2022 Vaclav Svejcar |
---|---|
License | BSD-3-Clause |
Maintainer | vaclav.svejcar@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Module providing support to perform selected network IO operations, such as downloading file content, etc.
Synopsis
- type DownloadContentFn m = URI -> m ByteString
- data Network m = Network {}
- mkNetwork :: MonadIO m => Network m
- downloadContent :: MonadIO m => URI -> m ByteString
- data NetworkError
Type Aliases
type DownloadContentFn m Source #
= URI | URI of remote resource |
-> m ByteString | downloaded content |
Type of a function that returns content of remote resource.
Polymorphic Record
Polymorphic record of functions performing network IO operations.
Network | |
|
mkNetwork :: MonadIO m => Network m Source #
Constructs new Network
that performs real network IO operations.
Network IO operations
:: MonadIO m | |
=> URI | URI of remote resource |
-> m ByteString | downloaded content |
Downloads content of remote resource as ByteString
. Note that only
http
and https
protocols are supported at this moment.
Error Data Types
data NetworkError Source #
Error related to network operations.
ConnectionFailure URI Text | connection failure |
InvalidStatus URI Int Text | invalid response status |
InvalidURL URI | given URI is not valid |
Instances
Eq NetworkError Source # | |
Defined in Headroom.IO.Network (==) :: NetworkError -> NetworkError -> Bool # (/=) :: NetworkError -> NetworkError -> Bool # | |
Show NetworkError Source # | |
Defined in Headroom.IO.Network showsPrec :: Int -> NetworkError -> ShowS # show :: NetworkError -> String # showList :: [NetworkError] -> ShowS # | |
Exception NetworkError Source # | |
Defined in Headroom.IO.Network |