Skip to content

Commit b6e9075

Browse files
committed
Address x-partial warning of GHC 9.8, drop building with GHC < 8
1 parent 31cc154 commit b6e9075

File tree

17 files changed

+227
-208
lines changed

17 files changed

+227
-208
lines changed

.github/workflows/haskell-ci-simple.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ jobs:
3232
# - "8.8.4"
3333
# - "8.10.7"
3434
# - "9.0.2"
35-
- "9.2.8"
36-
- "9.4.5"
37-
- "9.6.2"
35+
# - "9.2.8"
36+
- "9.4.7"
37+
- "9.6.3"
38+
- "9.8.1"
3839
steps:
39-
- uses: actions/checkout@v3
40+
- uses: actions/checkout@v4
4041

4142
- uses: haskell-actions/setup@v2
4243
id: setup-haskell-cabal

.github/workflows/haskell-ci.yml

Lines changed: 33 additions & 69 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/haskell-CI/haskell-ci
9+
# For more information, see https://github.com/andreasabel/haskell-ci
1010
#
11-
# version: 0.16.4
11+
# version: 0.17.20231012
1212
#
13-
# REGENDATA ("0.16.4",["github","alex.cabal"])
13+
# REGENDATA ("0.17.20231012",["github","alex.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -31,19 +31,24 @@ jobs:
3131
timeout-minutes:
3232
60
3333
container:
34-
image: buildpack-deps:bionic
34+
image: buildpack-deps:focal
3535
continue-on-error: ${{ matrix.allow-failure }}
3636
strategy:
3737
matrix:
3838
include:
39-
- compiler: ghc-9.6.2
39+
- compiler: ghc-9.8.1
4040
compilerKind: ghc
41-
compilerVersion: 9.6.2
41+
compilerVersion: 9.8.1
4242
setup-method: ghcup
4343
allow-failure: false
44-
- compiler: ghc-9.4.5
44+
- compiler: ghc-9.6.3
4545
compilerKind: ghc
46-
compilerVersion: 9.4.5
46+
compilerVersion: 9.6.3
47+
setup-method: ghcup
48+
allow-failure: false
49+
- compiler: ghc-9.4.7
50+
compilerKind: ghc
51+
compilerVersion: 9.4.7
4752
setup-method: ghcup
4853
allow-failure: false
4954
- compiler: ghc-9.2.8
@@ -64,74 +69,40 @@ jobs:
6469
- compiler: ghc-8.8.4
6570
compilerKind: ghc
6671
compilerVersion: 8.8.4
67-
setup-method: hvr-ppa
72+
setup-method: ghcup
6873
allow-failure: false
6974
- compiler: ghc-8.6.5
7075
compilerKind: ghc
7176
compilerVersion: 8.6.5
72-
setup-method: hvr-ppa
77+
setup-method: ghcup
7378
allow-failure: false
7479
- compiler: ghc-8.4.4
7580
compilerKind: ghc
7681
compilerVersion: 8.4.4
77-
setup-method: hvr-ppa
82+
setup-method: ghcup
7883
allow-failure: false
7984
- compiler: ghc-8.2.2
8085
compilerKind: ghc
8186
compilerVersion: 8.2.2
82-
setup-method: hvr-ppa
87+
setup-method: ghcup
8388
allow-failure: false
8489
- compiler: ghc-8.0.2
8590
compilerKind: ghc
8691
compilerVersion: 8.0.2
87-
setup-method: hvr-ppa
88-
allow-failure: false
89-
- compiler: ghc-7.10.3
90-
compilerKind: ghc
91-
compilerVersion: 7.10.3
92-
setup-method: hvr-ppa
93-
allow-failure: false
94-
- compiler: ghc-7.8.4
95-
compilerKind: ghc
96-
compilerVersion: 7.8.4
97-
setup-method: hvr-ppa
98-
allow-failure: false
99-
- compiler: ghc-7.6.3
100-
compilerKind: ghc
101-
compilerVersion: 7.6.3
102-
setup-method: hvr-ppa
103-
allow-failure: false
104-
- compiler: ghc-7.4.2
105-
compilerKind: ghc
106-
compilerVersion: 7.4.2
107-
setup-method: hvr-ppa
108-
allow-failure: false
109-
- compiler: ghc-7.0.4
110-
compilerKind: ghc
111-
compilerVersion: 7.0.4
112-
setup-method: hvr-ppa
92+
setup-method: ghcup
11393
allow-failure: false
11494
fail-fast: false
11595
steps:
11696
- name: apt
11797
run: |
11898
apt-get update
119-
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
120-
if [ "${{ matrix.setup-method }}" = ghcup ]; then
121-
mkdir -p "$HOME/.ghcup/bin"
122-
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
123-
chmod a+x "$HOME/.ghcup/bin/ghcup"
124-
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
125-
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
126-
else
127-
apt-add-repository -y 'ppa:hvr/ghc'
128-
apt-get update
129-
apt-get install -y "$HCNAME"
130-
mkdir -p "$HOME/.ghcup/bin"
131-
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
132-
chmod a+x "$HOME/.ghcup/bin/ghcup"
133-
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
134-
fi
99+
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev
100+
mkdir -p "$HOME/.ghcup/bin"
101+
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
102+
chmod a+x "$HOME/.ghcup/bin/ghcup"
103+
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
104+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
105+
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
135106
env:
136107
HCKIND: ${{ matrix.compilerKind }}
137108
HCNAME: ${{ matrix.compiler }}
@@ -143,20 +114,13 @@ jobs:
143114
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
144115
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
145116
HCDIR=/opt/$HCKIND/$HCVER
146-
if [ "${{ matrix.setup-method }}" = ghcup ]; then
147-
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
148-
echo "HC=$HC" >> "$GITHUB_ENV"
149-
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
150-
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
151-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
152-
else
153-
HC=$HCDIR/bin/$HCKIND
154-
echo "HC=$HC" >> "$GITHUB_ENV"
155-
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
156-
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
157-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
158-
fi
159-
117+
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
118+
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
119+
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
120+
echo "HC=$HC" >> "$GITHUB_ENV"
121+
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
122+
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
123+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
160124
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
161125
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
162126
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
@@ -218,7 +182,7 @@ jobs:
218182
$CABAL v2-install $ARG_COMPILER alex happy
219183
220184
- name: checkout
221-
uses: actions/checkout@v3
185+
uses: actions/checkout@v4
222186
with:
223187
path: source
224188

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## Changes in 3.4.0.1
2+
3+
* Address new `x-partial` warning of GHC 9.8.
4+
* Alex 3.4.0.1 needs GHC 8.0 or higher to build.
5+
The code it generates is the same as 3.4.0.0, so it will likely work for older GHCs.
6+
* Tested with GHC 8.0 - 9.8.1.
7+
8+
_Andreas Abel, 2023-10-29_
9+
110
## Changes in 3.4.0.0
211

312
* New wrappers to lex strict `Text`:

alex.cabal

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: >= 1.10
22
name: alex
3-
version: 3.4.0.0
3+
version: 3.4.0.1
44
-- don't forget updating changelog.md!
55
license: BSD3
66
license-file: LICENSE
@@ -22,8 +22,9 @@ category: Development
2222
build-type: Simple
2323

2424
tested-with:
25-
GHC == 9.6.2
26-
GHC == 9.4.5
25+
GHC == 9.8.1
26+
GHC == 9.6.3
27+
GHC == 9.4.7
2728
GHC == 9.2.8
2829
GHC == 9.0.2
2930
GHC == 8.10.7
@@ -32,11 +33,6 @@ tested-with:
3233
GHC == 8.4.4
3334
GHC == 8.2.2
3435
GHC == 8.0.2
35-
GHC == 7.10.3
36-
GHC == 7.8.4
37-
GHC == 7.6.3
38-
GHC == 7.4.2
39-
GHC == 7.0.4
4036

4137
data-dir: data/
4238

@@ -104,16 +100,26 @@ executable alex
104100
hs-source-dirs: src
105101
main-is: Main.hs
106102

107-
build-depends: base >= 2.1 && < 5
108-
, array
109-
, containers
110-
, directory
103+
build-depends:
104+
base >= 4.9 && < 5
105+
-- Data.List.NonEmpty enters `base` at 4.9
106+
, array
107+
, containers
108+
, directory
111109

112-
default-language: Haskell98
113-
default-extensions: CPP
114-
other-extensions: MagicHash
115-
116-
ghc-options: -Wall -rtsopts
110+
default-language:
111+
Haskell2010
112+
default-extensions:
113+
PatternSynonyms
114+
ScopedTypeVariables
115+
TupleSections
116+
other-extensions:
117+
CPP
118+
FlexibleContexts
119+
MagicHash
120+
NondecreasingIndentation
121+
OverloadedLists
122+
ghc-options: -Wall -Wcompat -rtsopts
117123

118124
other-modules:
119125
AbsSyn
@@ -144,6 +150,6 @@ test-suite tests
144150
-- This line is important as it ensures that the local `exe:alex` component declared above is built before the test-suite component is invoked, as well as making sure that `alex` is made available on $PATH and `$alex_datadir` is set accordingly before invoking `test.hs`
145151
build-tools: alex
146152

147-
default-language: Haskell98
153+
default-language: Haskell2010
148154

149155
build-depends: base, process

src/AbsSyn.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import Util ( str, nl )
3232

3333
import Data.Maybe ( fromJust )
3434

35-
infixl 4 :|
35+
infixl 4 :||
3636
infixl 5 :%%
3737

3838
-- -----------------------------------------------------------------------------
@@ -200,7 +200,7 @@ usesPreds dfa
200200
-- `RExp' provides an abstract syntax for regular expressions. `Eps' will
201201
-- match empty strings; `Ch p' matches strings containing a single character
202202
-- `c' if `p c' is true; `re1 :%% re2' matches a string if `re1' matches one of
203-
-- its prefixes and `re2' matches the rest; `re1 :| re2' matches a string if
203+
-- its prefixes and `re2' matches the rest; `re1 :|| re2' matches a string if
204204
-- `re1' or `re2' matches it; `Star re', `Plus re' and `Ques re' can be
205205
-- expressed in terms of the other operators. See the definitions of `ARexp'
206206
-- for a formal definition of the semantics of these operators.
@@ -209,7 +209,7 @@ data RExp
209209
= Eps -- ^ Empty.
210210
| Ch CharSet -- ^ Singleton.
211211
| RExp :%% RExp -- ^ Sequence.
212-
| RExp :| RExp -- ^ Alternative.
212+
| RExp :|| RExp -- ^ Alternative.
213213
| Star RExp -- ^ Zero or more repetitions.
214214
| Plus RExp -- ^ One or more repetitions.
215215
| Ques RExp -- ^ Zero or one repetitions.
@@ -218,7 +218,7 @@ instance Show RExp where
218218
showsPrec _ Eps = showString "()"
219219
showsPrec _ (Ch _) = showString "[..]"
220220
showsPrec _ (l :%% r) = shows l . shows r
221-
showsPrec _ (l :| r) = shows l . ('|':) . shows r
221+
showsPrec _ (l :|| r) = shows l . ('|':) . shows r
222222
showsPrec _ (Star r) = shows r . ('*':)
223223
showsPrec _ (Plus r) = shows r . ('+':)
224224
showsPrec _ (Ques r) = shows r . ('?':)
@@ -228,7 +228,7 @@ nullable :: RExp -> Bool
228228
nullable Eps = True
229229
nullable Ch{} = False
230230
nullable (l :%% r) = nullable l && nullable r
231-
nullable (l :| r) = nullable l || nullable r
231+
nullable (l :|| r) = nullable l || nullable r
232232
nullable Star{} = True
233233
nullable (Plus r) = nullable r
234234
nullable Ques{} = True
@@ -264,7 +264,7 @@ arexp:: RExp -> ARexp
264264
arexp Eps = eps_ar
265265
arexp (Ch p) = ch_ar p
266266
arexp (re :%% re') = arexp re `seq_ar` arexp re'
267-
arexp (re :| re') = arexp re `bar_ar` arexp re'
267+
arexp (re :|| re') = arexp re `bar_ar` arexp re'
268268
arexp (Star re) = star_ar (arexp re)
269269
arexp (Plus re) = plus_ar (arexp re)
270270
arexp (Ques re) = ques_ar (arexp re)

0 commit comments

Comments
 (0)