Skip to content

Commit 825aa64

Browse files
committed
7.9.2 - support for xhtml >= 3000.3
1 parent 19350e4 commit 825aa64

3 files changed

Lines changed: 58 additions & 29 deletions

File tree

.github/workflows/haskell-ci.yml

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
#
77
# haskell-ci regenerate
88
#
9-
# For more information, see https://github.com/andreasabel/haskell-ci
9+
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.17.20231012
11+
# version: 0.18.1
1212
#
13-
# REGENDATA ("0.17.20231012",["github","happstack-server.cabal"])
13+
# REGENDATA ("0.18.1",["github","happstack-server.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -27,14 +27,19 @@ jobs:
2727
timeout-minutes:
2828
60
2929
container:
30-
image: buildpack-deps:focal
30+
image: buildpack-deps:bionic
3131
continue-on-error: ${{ matrix.allow-failure }}
3232
strategy:
3333
matrix:
3434
include:
35-
- compiler: ghc-9.8.1
35+
- compiler: ghc-9.10.1
3636
compilerKind: ghc
37-
compilerVersion: 9.8.1
37+
compilerVersion: 9.10.2
38+
setup-method: ghcup
39+
allow-failure: false
40+
- compiler: ghc-9.8.2
41+
compilerKind: ghc
42+
compilerVersion: 9.8.2
3843
setup-method: ghcup
3944
allow-failure: false
4045
- compiler: ghc-9.6.3
@@ -65,40 +70,49 @@ jobs:
6570
- compiler: ghc-8.8.4
6671
compilerKind: ghc
6772
compilerVersion: 8.8.4
68-
setup-method: ghcup
73+
setup-method: hvr-ppa
6974
allow-failure: false
7075
- compiler: ghc-8.6.5
7176
compilerKind: ghc
7277
compilerVersion: 8.6.5
73-
setup-method: ghcup
78+
setup-method: hvr-ppa
7479
allow-failure: false
7580
- compiler: ghc-8.4.4
7681
compilerKind: ghc
7782
compilerVersion: 8.4.4
78-
setup-method: ghcup
83+
setup-method: hvr-ppa
7984
allow-failure: false
8085
- compiler: ghc-8.2.2
8186
compilerKind: ghc
8287
compilerVersion: 8.2.2
83-
setup-method: ghcup
88+
setup-method: hvr-ppa
8489
allow-failure: false
8590
- compiler: ghc-8.0.2
8691
compilerKind: ghc
8792
compilerVersion: 8.0.2
88-
setup-method: ghcup
93+
setup-method: hvr-ppa
8994
allow-failure: false
9095
fail-fast: false
9196
steps:
9297
- name: apt
9398
run: |
9499
apt-get update
95-
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev
96-
mkdir -p "$HOME/.ghcup/bin"
97-
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
98-
chmod a+x "$HOME/.ghcup/bin/ghcup"
99-
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
100-
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
101-
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
100+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
101+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
102+
mkdir -p "$HOME/.ghcup/bin"
103+
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
104+
chmod a+x "$HOME/.ghcup/bin/ghcup"
105+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
106+
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
107+
else
108+
apt-add-repository -y 'ppa:hvr/ghc'
109+
apt-get update
110+
apt-get install -y "$HCNAME"
111+
mkdir -p "$HOME/.ghcup/bin"
112+
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
113+
chmod a+x "$HOME/.ghcup/bin/ghcup"
114+
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
115+
fi
102116
env:
103117
HCKIND: ${{ matrix.compilerKind }}
104118
HCNAME: ${{ matrix.compiler }}
@@ -110,13 +124,22 @@ jobs:
110124
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
111125
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
112126
HCDIR=/opt/$HCKIND/$HCVER
113-
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
114-
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
115-
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
116-
echo "HC=$HC" >> "$GITHUB_ENV"
117-
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
118-
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
119-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
127+
if [ "${{ matrix.setup-method }}" = ghcup ]; then
128+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
129+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
130+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
131+
echo "HC=$HC" >> "$GITHUB_ENV"
132+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
133+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
134+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
135+
else
136+
HC=$HCDIR/bin/$HCKIND
137+
echo "HC=$HC" >> "$GITHUB_ENV"
138+
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
139+
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
140+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
141+
fi
142+
120143
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
121144
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
122145
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
@@ -173,7 +196,7 @@ jobs:
173196
chmod a+x $HOME/.cabal/bin/cabal-plan
174197
cabal-plan --version
175198
- name: checkout
176-
uses: actions/checkout@v4
199+
uses: actions/checkout@v3
177200
with:
178201
path: source
179202
- name: initial cabal.project for sdist

happstack-server.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Name: happstack-server
2-
Version: 7.9.1.1
2+
Version: 7.9.2
33
Synopsis: Web related tools and services.
44
Description: Happstack Server provides an HTTP server and a rich set of functions for routing requests, handling query parameters, generating responses, working with cookies, serving files, and more. For in-depth documentation see the Happstack Crash Course <http://happstack.com/docs/crashcourse/index.html>
55
License: BSD3
@@ -13,7 +13,7 @@ Cabal-Version: >= 1.10
1313
Extra-Source-Files: tests/Happstack/Server/Tests.hs README.md
1414

1515
tested-with:
16-
GHC == 9.8.1
16+
GHC == 9.8.2
1717
GHC == 9.6.3
1818
GHC == 9.4.7
1919
GHC == 9.2.8

src/Happstack/Server/Response.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ module Happstack.Server.Response
2626
, ifModifiedSince
2727
) where
2828

29+
#if MIN_VERSION_xhtml(3000,3,0)
30+
import qualified Data.ByteString.Builder as L
31+
#endif
2932
import qualified Data.ByteString.Char8 as B
3033
import qualified Data.ByteString.Lazy.Char8 as L
3134
import qualified Data.ByteString.Lazy.UTF8 as LU (fromString)
@@ -140,8 +143,11 @@ instance ToMessage Html where
140143

141144
instance ToMessage XHtml.Html where
142145
toContentType _ = B.pack "text/html; charset=UTF-8"
146+
#if MIN_VERSION_xhtml(3000,3,0)
147+
toMessage = L.toLazyByteString . XHtml.renderHtml
148+
#else
143149
toMessage = LU.fromString . XHtml.renderHtml
144-
150+
#endif
145151
instance ToMessage Blaze.Html where
146152
toContentType _ = B.pack "text/html; charset=UTF-8"
147153
toMessage = Blaze.renderHtml

0 commit comments

Comments
 (0)