| Copyright | (c) 2019-2022 Vaclav Svejcar |
|---|---|
| License | BSD-3-Clause |
| Maintainer | vaclav.svejcar@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Headroom.IO.Network
Description
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 #
Arguments
| = 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.
Constructors
| Network | |
Fields
| |
mkNetwork :: MonadIO m => Network m Source #
Constructs new Network that performs real network IO operations.
Network IO operations
Arguments
| :: 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.
Constructors
| 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 | |
| Show NetworkError Source # | |
Defined in Headroom.IO.Network Methods showsPrec :: Int -> NetworkError -> ShowS # show :: NetworkError -> String # showList :: [NetworkError] -> ShowS # | |
| Exception NetworkError Source # | |
Defined in Headroom.IO.Network Methods toException :: NetworkError -> SomeException # fromException :: SomeException -> Maybe NetworkError # displayException :: NetworkError -> String # | |