HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehttp-types-0.12.4Haskell2010

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.

  • 6 types
  • 59 values
  • Packagehttp-types-0.12.4
  • Exports65
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceHeader.hs

HTTP Headers

4 declarations
typetype Header = (HeaderName, ByteString)
#

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")

typetype HeaderName = CI ByteString
#

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.

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]