Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6145568
ci.yml: use custom project file for building with GHC 7.10.3
Vlix Aug 13, 2026
4cb1faa
use 'word8' in 'Builder's, more hex usage, and some simplification/do…
Vlix Jun 29, 2026
a5e095b
test: added test for lowercase percent encoded decoding
Vlix Jun 29, 2026
81d50f2
documentation improvements
Vlix Jun 29, 2026
7b41313
added pattern synonyms for 'HttpVersion' constants
Vlix Jun 29, 2026
b84d5a4
add more header constants and unit tests for the new constants
Vlix Jun 29, 2026
9e3d42a
update CHANGELOG
Vlix Jun 29, 2026
cd1f8e0
add status pattern synonyms
Vlix Jun 29, 2026
2ba3aa4
add render functions for the 'Status'
Vlix Jun 29, 2026
c330167
test: unit tests for 'Status' rendering, and fixing found errors
Vlix Jun 29, 2026
f10cdd7
add parsing of status codes
Vlix Jun 29, 2026
2c1fdcd
test: add testing of parsing of status codes
Vlix Jun 29, 2026
5c781b8
CHANGELOG entry about parsing/rendering status codes, and fixing the …
Vlix Jun 29, 2026
0014187
fixes to build with GHC 7.10.3
Vlix Jun 29, 2026
e2e1913
hopefully fix building with GHC 7.10.3
Vlix Jun 29, 2026
7b077c6
unsafeWithForeignPtr fix
Vlix Jun 29, 2026
c6b944f
more 7.10.3 fixes
Vlix Jun 29, 2026
9c17408
more fixes
Vlix Jun 29, 2026
44b70ee
test: add pattern match tests for the pattern synonyms
Vlix Jun 29, 2026
7981aa7
miscellaneous adjustments
Vlix Jul 2, 2026
d90e45d
bump version to 0.13.0
Vlix Aug 13, 2026
2a91a0a
haddock should display 'since 0.13.0'
Vlix Aug 13, 2026
48608ab
ci: better caching
Vlix Aug 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 121 additions & 89 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,25 @@ on:
- reopened
- synchronize
paths:
- '**.hs'
- '**.cabal'
- 'stack.yaml'
- '.github/workflows/ci.yml'
- "**.hs"
- "**.cabal"
- "stack.yaml"
- ".github/workflows/ci.yml"
push:
branches: [master]

jobs:
# Just to test very old compiler for low base version dependency
oldest:
name: oldest / ghc-7.10.3 / ubuntu
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: "7.10.3"
cabal-version: 3.0.0.0

- uses: actions/cache@v3
name: Cache cabal-store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ubuntu-7.10.3-cabal

- name: Build
run: |
cabal build --ghc-option='-Wall' \
--constraint="bytestring==0.10.6.0" \
--constraint="array==0.5.1.0" \
--constraint="case-insensitive==1.2.0.2" \
--constraint="text==1.2.0.2"

cabal:
env:
MANUAL_RESET: v4
name: cabal / ghc-${{matrix.ghc}} / ${{ matrix.os }}
continue-on-error: ${{ matrix.ghc == '9.14.1'}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
# - macOS-latest # Is giving issues for some reason
cabal: ["latest"]
ghc:
- "9.6.7"
Expand All @@ -63,38 +36,52 @@ jobs:
- "9.14.1"

steps:
- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
id: setup-haskell-cabal
name: Setup Haskell
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: true

- uses: actions/cache@v3
name: Cache cabal-store
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal

- name: Build
run: |
cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=always --ghc-option='-Wall'
- name: Test
run: |
cabal test test:spec --enable-tests --ghc-option='-Wall'
- name: Test Docs
run: |
cabal exec -- cabal test test:doctests --enable-tests --ghc-option='-Wall'
- uses: actions/checkout@v4

- name: Cache GHCup
uses: actions/cache@v6
id: ghcup-cache
with:
path: |
~/.ghcup/bin/*
~/.ghcup/cache/*
~/.ghcup/config.yaml
~/.ghcup/ghc/${{ matrix.ghc }}
key: CI-ghcup-cabal-${{ env.MANUAL_RESET }}-${{ matrix.ghc }}

- name: Setup Haskell
if: steps.ghcup-cache.outputs.cache-hit != 'true'
uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: true

- name: Cache cabal
uses: actions/cache@v6
with:
path: ~/.cabal
key: ${{ matrix.ghc }}-cabal

- name: Build
run: |
cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=always --ghc-option='-Wall'
- name: Test
run: |
cabal test test:spec --enable-tests --ghc-option='-Wall'
- name: Test Docs
run: |
cabal exec -- cabal test test:doctests --enable-tests --ghc-option='-Wall'
# # We probably want to add benchmarks at some point, just to make sure
# # functions don't regress in performance too much?
# - name: Bench
# run: |
# cabal bench --enable-benchmarks
stack:
name: stack ${{ matrix.resolver }}
env:
MANUAL_RESET: v3
runs-on: ubuntu-latest
# This makes the CI jobs not all be cancelled if nightly fails to build.
# However, if nightly fails to build, CI still gets a red X in the GitHub UI.
Expand All @@ -104,40 +91,85 @@ jobs:
# When some sort of `allow-failure` functionality is available in GitHub
# actions, we should switch to it:
# https://github.com/actions/toolkit/issues/399
continue-on-error: ${{ matrix.resolver == '--resolver nightly' }}
continue-on-error: ${{ matrix.resolver == 'nightly' || matrix.resolver == 'lts-12' }}
strategy:
matrix:
stack: ["latest"]
resolver:
- "--resolver lts-22" # GHC 9.6.7
- "--resolver lts-23" # GHC 9.8.4
- "--resolver lts-24" # GHC 9.10.3
- "--resolver nightly" # GHC 9.12.4
include:
- resolver: "lts-12"
ghc: "8.4.4"
- resolver: "lts-22"
ghc: "9.6.7"
- resolver: "lts-23"
ghc: "9.8.4"
- resolver: "lts-24"
ghc: "9.10.3"
- resolver: "nightly"
ghc: "9.12.4"

steps:
- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
name: Setup Haskell Stack
with:
stack-version: ${{ matrix.stack }}
enable-stack: true

- uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ${{ steps.setup-haskell-cabal.outputs.stack-root }}
key: ${{ runner.os }}-${{ matrix.resolver }}-stack

- name: Build
run: |
stack build ${{ matrix.resolver }} --test --bench --no-run-tests --no-run-benchmarks --ghc-options='-Wall'
- name: Test
run: |
stack test --no-rerun-tests http-types:test:spec ${{ matrix.resolver }}
- name: Test Docs
run: |
stack test http-types:test:doctests ${{ matrix.resolver }}
- uses: actions/checkout@v4

- name: Cache GHCup
uses: actions/cache@v6
id: ghcup-cache
with:
path: |
~/.ghcup/bin/*
~/.ghcup/cache/*
~/.ghcup/config.yaml
~/.ghcup/ghc/${{ matrix.ghc }}
~/.ghcup/stack/*
key: CI-ghcup-stack-${{ env.MANUAL_RESET }}-${{ matrix.ghc }}

- name: Setup Haskell Stack
uses: haskell-actions/setup@v2
if: steps.ghcup-cache.outputs.cache-hit != 'true'
with:
stack-version: "latest"
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-setup-ghc: false

- name: Cache Pantry (Stackage package index)
id: pantry
uses: actions/cache@v6
with:
path: ~/.stack/pantry
key: CI-pantry-${{ env.MANUAL_RESET }}-${{ matrix.resolver }}

- name: Recompute Stackage package index
if: steps.pantry.outputs.cache-hit != 'true'
run: stack update # populates ~/.stack/pantry

- name: Cache Dependencies
uses: actions/cache@v6
with:
path: |
~/.stack/stack.sqlite3
~/.stack/snapshots
key: ${{ runner.os }}-${{ matrix.resolver }}-stack

- name: Build lts-12
if: "${{ matrix.resolver == 'lts-12' }}"
run: |
stack config set system-ghc true --global
stack build --resolver=${{ matrix.resolver }} --ghc-options='-Wall'

- name: Build
if: "${{ matrix.resolver != 'lts-12' }}"
run: |
stack config set system-ghc true --global
stack build --resolver=${{ matrix.resolver }} --test --bench \
--no-run-tests --no-run-benchmarks --ghc-options='-Wall'
- name: Test
if: "${{ matrix.resolver != 'lts-12' }}"
run: |
stack test --no-rerun-tests http-types:test:spec --resolver=${{ matrix.resolver }}
- name: Test Docs
if: "${{ matrix.resolver != 'lts-12' }}"
run: |
stack test http-types:test:doctests --resolver=${{ matrix.resolver }}

# # We probably want to add benchmarks at some point, just to make sure
# # functions don't regress in performance too much?
# - name: Bench
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog for `http-types`

## 0.13.0 [unreleased]

* Add parsing and rendering functions for `Status`
* Add pattern synonyms for `HttpVersion`
* `Http09`
* `Http10`
* `Http11`
* `Http20`
* `Http30`
* Add pattern synonyms for `Status`
* all of format `StatusXXX`
* Add more constant headers:
* `hAcceptPatch`
* `hAccessControlAllowCredentials`
* `hAccessControlAllowHeaders`
* `hAccessControlAllowMethods`
* `hAccessControlAllowOrigin`
* `hAccessControlExposeHeaders`
* `hAccessControlMaxAge`
* `hAccessControlRequestMethod`
* `hAltSvc`
* `hContentDigest`
* `hContentSecurityPolicy`
* `hContentSecurityPolicyReportOnly`
* `hForwarded`
* `hLink`
* `hStrictTransportSecurity`

## 0.12.6 [2026-08-13]

* Remove `array` dependency
Expand Down
34 changes: 29 additions & 5 deletions Network/HTTP/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ module Network.HTTP.Types (
-- * Methods

-- | __For more information__: "Network.HTTP.Types.Method"

Method,

-- ** Constants
Expand All @@ -25,7 +24,6 @@ module Network.HTTP.Types (
-- * Versions

-- | __For more information__: "Network.HTTP.Types.Version"

HttpVersion (..),
http09,
http10,
Expand All @@ -36,11 +34,20 @@ module Network.HTTP.Types (
-- * Status

-- | __For more information__: "Network.HTTP.Types.Status"

Status (..),
mkStatus,

-- ** Parsing and Rendering
parseStatusCode,
renderStatusCode,
parseFullStatus,
renderFullStatus,

-- ** Low level functions
renderStatusCodeToPtr,
renderFullStatusToPtr,

-- ** Constants
mkStatus,
status100,
continue100,
status101,
Expand Down Expand Up @@ -139,6 +146,8 @@ module Network.HTTP.Types (
httpVersionNotSupported505,
status511,
networkAuthenticationRequired511,

-- *** Category checks
statusIsInformational,
statusIsSuccessful,
statusIsRedirection,
Expand All @@ -155,30 +164,43 @@ module Network.HTTP.Types (
RequestHeaders,
ResponseHeaders,

-- ** Header constants
-- ** Constants
hAccept,
hAcceptCharset,
hAcceptEncoding,
hAcceptLanguage,
hAcceptPatch,
hAcceptRanges,
hAccessControlAllowCredentials,
hAccessControlAllowHeaders,
hAccessControlAllowMethods,
hAccessControlAllowOrigin,
hAccessControlExposeHeaders,
hAccessControlMaxAge,
hAccessControlRequestMethod,
hAge,
hAllow,
hAltSvc,
hAuthorization,
hCacheControl,
hConnection,
hContentDigest,
hContentDisposition,
hContentEncoding,
hContentLanguage,
hContentLength,
hContentLocation,
hContentMD5,
hContentRange,
hContentSecurityPolicy,
hContentSecurityPolicyReportOnly,
hContentType,
hCookie,
hDate,
hETag,
hExpect,
hExpires,
hForwarded,
hFrom,
hHost,
hIfMatch,
Expand All @@ -187,6 +209,7 @@ module Network.HTTP.Types (
hIfRange,
hIfUnmodifiedSince,
hLastModified,
hLink,
hLocation,
hMaxForwards,
hMIMEVersion,
Expand All @@ -201,6 +224,7 @@ module Network.HTTP.Types (
hRetryAfter,
hServer,
hSetCookie,
hStrictTransportSecurity,
hTE,
hTrailer,
hTransferEncoding,
Expand Down
Loading
Loading