Skip to content

Commit dd78e29

Browse files
committed
GHC-9.8 support
1 parent 5173ca9 commit dd78e29

File tree

4 files changed

+42
-72
lines changed

4 files changed

+42
-72
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.16
11+
# version: 0.17.20231010
1212
#
13-
# REGENDATA ("0.16",["github","cabal.project"])
13+
# REGENDATA ("0.17.20231010",["github","cabal.project"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -32,19 +32,24 @@ jobs:
3232
strategy:
3333
matrix:
3434
include:
35-
- compiler: ghc-9.6.1
35+
- compiler: ghc-9.8.1
3636
compilerKind: ghc
37-
compilerVersion: 9.6.1
37+
compilerVersion: 9.8.1
3838
setup-method: ghcup
3939
allow-failure: false
40-
- compiler: ghc-9.4.4
40+
- compiler: ghc-9.6.3
4141
compilerKind: ghc
42-
compilerVersion: 9.4.4
42+
compilerVersion: 9.6.3
4343
setup-method: ghcup
4444
allow-failure: false
45-
- compiler: ghc-9.2.7
45+
- compiler: ghc-9.4.7
4646
compilerKind: ghc
47-
compilerVersion: 9.2.7
47+
compilerVersion: 9.4.7
48+
setup-method: ghcup
49+
allow-failure: false
50+
- compiler: ghc-9.2.8
51+
compilerKind: ghc
52+
compilerVersion: 9.2.8
4853
setup-method: ghcup
4954
allow-failure: false
5055
- compiler: ghc-9.0.2
@@ -120,7 +125,7 @@ jobs:
120125
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
121126
if [ "${{ matrix.setup-method }}" = ghcup ]; then
122127
mkdir -p "$HOME/.ghcup/bin"
123-
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
128+
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
124129
chmod a+x "$HOME/.ghcup/bin/ghcup"
125130
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
126131
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
@@ -129,7 +134,7 @@ jobs:
129134
apt-get update
130135
apt-get install -y "$HCNAME"
131136
mkdir -p "$HOME/.ghcup/bin"
132-
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
137+
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
133138
chmod a+x "$HOME/.ghcup/bin/ghcup"
134139
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
135140
fi
@@ -145,10 +150,12 @@ jobs:
145150
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
146151
HCDIR=/opt/$HCKIND/$HCVER
147152
if [ "${{ matrix.setup-method }}" = ghcup ]; then
148-
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
153+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
154+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
155+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
149156
echo "HC=$HC" >> "$GITHUB_ENV"
150-
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
151-
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
157+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
158+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
152159
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
153160
else
154161
HC=$HCDIR/bin/$HCKIND
@@ -216,8 +223,8 @@ jobs:
216223
- name: install cabal-docspec
217224
run: |
218225
mkdir -p $HOME/.cabal/bin
219-
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20230406/cabal-docspec-0.0.0.20230406-x86_64-linux.xz > cabal-docspec.xz
220-
echo '68fa9addd5dc453d533a74a763950499d4593b1297c9a05c3ea5bd1acc04c9dd cabal-docspec.xz' | sha256sum -c -
226+
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20230517/cabal-docspec-0.0.0.20230517-x86_64-linux.xz > cabal-docspec.xz
227+
echo '3b31bbe463ad4d671abbc103db49628562ec48a6604cab278207b5b6acd21ed7 cabal-docspec.xz' | sha256sum -c -
221228
xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec
222229
rm -f cabal-docspec.xz
223230
chmod a+x $HOME/.cabal/bin/cabal-docspec
@@ -298,10 +305,14 @@ jobs:
298305
rm -f cabal.project.local
299306
- name: constraint set intersection
300307
run: |
308+
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere +rere-intersection' all --dry-run
309+
cabal-plan topo | sort
301310
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere +rere-intersection' --dependencies-only -j2 all
302311
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere +rere-intersection' all
303312
- name: constraint set no-cfg
304313
run: |
314+
if [ $((HCNUMVER >= 70800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere -rere-cfg' all --dry-run ; fi
315+
if [ $((HCNUMVER >= 70800)) -ne 0 ] ; then cabal-plan topo | sort ; fi
305316
if [ $((HCNUMVER >= 70800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere -rere-cfg' --dependencies-only -j2 all ; fi
306317
if [ $((HCNUMVER >= 70800)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --constraint='rere -rere-cfg' all ; fi
307318
- name: save cache

bench/JSON.hs

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,13 @@ module Main (main, jsonRE, jsonRE', jsonNames, jsonCFG, jsonDerp, derp) where
77
import Prelude hiding (exponent)
88

99
import Criterion.Main (bench, defaultMain, whnf)
10-
import Data.Either (isRight)
10+
import Data.Maybe (isJust)
1111
import System.Clock (Clock (Monotonic), diffTimeSpec, getTime)
1212

13-
import qualified Data.Aeson.Parser as A
14-
import qualified Data.Attoparsec.ByteString as Atto
15-
import qualified Data.ByteString as BS
16-
import qualified Data.Set as Set
17-
import qualified Text.Derp as D
18-
19-
#ifdef MIN_VERSION_saison
20-
import qualified Saison.Decoding.Parser as S
21-
import qualified Saison.Decoding.Tokens as S
22-
#endif
13+
import qualified Data.Aeson as A
14+
import qualified Data.ByteString as BS
15+
import qualified Data.Set as Set
16+
import qualified Text.Derp as D
2317

2418
import RERE
2519
import RERE.Examples.JSON
@@ -34,32 +28,7 @@ derp :: D.Parser Char () -> String -> Bool
3428
derp p s = not $ Set.null $ D.runParse p [ D.Token c [c] | c <- s]
3529

3630
aeson :: BS.ByteString -> Bool
37-
aeson bs = isRight (Atto.parseOnly (A.json <* Atto.endOfInput) bs)
38-
39-
#ifdef MIN_VERSION_saison
40-
saison :: BS.ByteString -> Bool
41-
saison = go end . S.tokens where
42-
end :: BS.ByteString -> Bool
43-
end = BS.null . S.skipSpace
44-
45-
go :: (k -> Bool) -> S.Tokens k e -> Bool
46-
go kont (S.TkLit _ k) = kont k
47-
go kont (S.TkText _ k) = kont k
48-
go kont (S.TkNumber _ k) = kont k
49-
go kont (S.TkArrayOpen arr) = goArr kont arr
50-
go kont (S.TkRecordOpen obj) = goObj kont obj
51-
go _ (S.TkErr _) = False
52-
53-
goArr :: (k -> Bool) -> S.TkArray k e -> Bool
54-
goArr kont (S.TkItem k) = go (goArr kont) k
55-
goArr kont (S.TkArrayEnd k) = kont k
56-
goArr _ (S.TkArrayErr _) = False
57-
58-
goObj :: (k -> Bool) -> S.TkRecord k e -> Bool
59-
goObj kont (S.TkPair _ k) = go (goObj kont) k
60-
goObj kont (S.TkRecordEnd k) = kont k
61-
goObj _ (S.TkRecordErr _) = False
62-
#endif
31+
aeson bs = isJust (A.decodeStrict bs :: Maybe A.Value)
6332

6433
main :: IO ()
6534
main = do
@@ -90,10 +59,7 @@ main = do
9059
putStrLn "Criterion"
9160
defaultMain
9261
[ bench "aeson" $ whnf aeson bs
93-
#ifdef MIN_VERSION_saison
94-
, bench "saison" $ whnf saison bs
95-
#endif
96-
-- , bench "rere" $ whnf (matchR jsonRE) contents
62+
, bench "rere" $ whnf (matchST jsonRE) contents
9763
]
9864

9965
-------------------------------------------------------------------------------

cabal.project

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,5 @@ benchmarks: True
55

66
constraints: rere +rere-intersection
77

8-
-- allow-newer: async-2.2.2:base
9-
-- allow-newer: dec-0.0.3:base
10-
-- allow-newer: fin-0.1.1:base
11-
-- allow-newer: hashable-1.3.0.0:base
12-
-- allow-newer: vec-0.3:base
13-
148
package rere
159
-- ghc-options: -Wall -Werror

rere.cabal

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cabal-version: 2.2
22
name: rere
3-
version: 0.2
4-
x-revision: 3
3+
version: 0.2.0.1
54
synopsis:
65
Regular-expressions extended with fixpoints for context-free powers
76

@@ -33,9 +32,10 @@ tested-with:
3332
|| ==8.8.4
3433
|| ==8.10.7
3534
|| ==9.0.2
36-
|| ==9.2.7
37-
|| ==9.4.4
38-
|| ==9.6.1
35+
|| ==9.2.8
36+
|| ==9.4.7
37+
|| ==9.6.3
38+
|| ==9.8.1
3939

4040
source-repository head
4141
type: git
@@ -61,7 +61,7 @@ library
6161

6262
-- GHC boot libraries
6363
build-depends:
64-
, base >=4.3.0.0 && <4.19
64+
, base >=4.3.0.0 && <4.20
6565
, containers ^>=0.4.0.0 || ^>=0.5.0.0 || ^>=0.6.0.1
6666
, parsec ^>=3.1.12.0
6767
, transformers ^>=0.3.0.0 || ^>=0.4.2.0 || ^>=0.5.2.0 || ^>=0.6.1.0
@@ -146,8 +146,7 @@ benchmark json
146146
other-modules: DerpConv
147147
ghc-options: -Wall -rtsopts
148148
build-depends:
149-
, aeson ^>=1.4.6.0 || ^>=1.5.0.0 || ^>=2.0.0.0 || ^>=2.1.0.0
150-
, attoparsec
149+
, aeson ^>=1.4.6.0 || ^>=1.5.0.0 || ^>=2.0.0.0 || ^>=2.1.0.0 || ^>=2.2.1.0
151150
, base
152151
, bytestring
153152
, clock ^>=0.8
@@ -180,9 +179,9 @@ test-suite properties
180179
, base
181180
, containers
182181
, QuickCheck
183-
, quickcheck-instances ^>=0.3.22
182+
, quickcheck-instances ^>=0.3.30
184183
, rere
185-
, tasty ^>=1.4.0.1
184+
, tasty ^>=1.4.0.1 || ^>=1.5
186185
, tasty-quickcheck ^>=0.10.1.1
187186

188187
if flag(rere-intersection)

0 commit comments

Comments
 (0)