HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulehttp-types-0.12.6Haskell2010

Network.HTTP.Types.Header

Type and constants for handling HTTP header fields.

At the bottom are also some functions to handle certain header field values.

Contents
  1. HTTP Headers
  2. Common headers
  3. Byte ranges
Synopsis
  • Packagehttp-types-0.12.6
  • Exports65
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceHeader.hs

HTTP Headers

A full HTTP header field with the name and value separated.

E.g. "Content-Length: 28" parsed into a Header would turn into ("Content-Length", "28")

A case-insensitive name of a header field.

This is the part of the header field before the colon: HeaderName: some value

Common headers

The following header constants are provided for convenience, to prevent accidental spelling errors.

Byte ranges

Convenience functions and types to handle values from Range headers.

https://www.rfc-editor.org/rfc/rfc9110.html#name-byte-ranges

datadata ByteRange

An individual byte range. Used in Range request headers. This type and its accompanying functions are NOT compatible with the Content-Range response header.

Negative indices are not allowed!

Instances6Eq, Data, Ord, Show, Generic, Rep

Parse the value of a Range header into a ByteRanges.

Example8 expressions
parseByteRanges "error"NothingparseByteRanges "bytes=0-499"Just [ByteRangeFromTo 0 499]parseByteRanges "bytes=500-999"Just [ByteRangeFromTo 500 999]parseByteRanges "bytes=-500"Just [ByteRangeSuffix 500]parseByteRanges "bytes=9500-"Just [ByteRangeFrom 9500]parseByteRanges "bytes=0-0,-1"Just [ByteRangeFromTo 0 0,ByteRangeSuffix 1]parseByteRanges "bytes=500-600,601-999"Just [ByteRangeFromTo 500 600,ByteRangeFromTo 601 999]parseByteRanges "bytes=500-700,601-999"Just [ByteRangeFromTo 500 700,ByteRangeFromTo 601 999]