headroom-0.4.3.0: License Header Manager
Copyright(c) 2019-2022 Vaclav Svejcar
LicenseBSD-3-Clause
Maintainervaclav.svejcar@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Headroom.IO.Network

Description

Module providing support to perform selected network IO operations, such as downloading file content, etc.

Synopsis

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

data Network m Source #

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

downloadContent Source #

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