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-4000.4.1Haskell98

Network.HTTP.Headers

This module provides the data types for representing HTTP headers, and operations for looking up header values and working with sequences of header values in Requests and Responses. To avoid having to provide separate set of operations for doing so, we introduce a type class HasHeaders to facilitate writing such processing using overloading instead.

  • 3 types
  • 1 class
  • 13 values
  • PackageHTTP-4000.4.1
  • Exports17
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceHeaders.hs
classclass HasHeaders x where
#

HasHeaders is a type class for types containing HTTP headers, allowing you to write overloaded header manipulation functions for both Request and Response data types, for instance.

Methods

Instances2HasHeaders
datadata HeaderName
#

HTTP HeaderName type, a Haskell data constructor for each specification-defined header, prefixed with Hdr and CamelCased, (i.e., eliding the - in the process.) Should you require using a custom header, there's the HdrCustom constructor which takes a String argument.

Encoding HTTP header names differently, as Strings perhaps, is an equally fine choice..no decidedly clear winner, but let's stick with data constructors here.

Instances2Eq, Show

insertHeader hdr val x inserts a header with the given header name and value. Does not check for existing headers with same name, allowing duplicates to be introduce (use replaceHeader if you want to avoid this.)

valueparseHeaders :: [String] -> Result [Header]
#

parseHeaders hdrs takes a sequence of strings holding header information and parses them into a set of headers (preserving their order in the input argument.) Handles header values split up over multiple lines.