Skip to content

Commit

Permalink
Support GHC 9.10.
Browse files Browse the repository at this point in the history
Fixes #48.
  • Loading branch information
athas committed May 16, 2024
1 parent 0b924b8 commit d53113b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.17.20231010
# version: 0.19.20240514
#
# REGENDATA ("0.17.20231010",["github","cabal.project"])
# REGENDATA ("0.19.20240514",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -28,6 +28,11 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.10.1
compilerKind: ghc
compilerVersion: 9.10.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.8.1
compilerKind: ghc
compilerVersion: 9.8.1
Expand Down Expand Up @@ -86,18 +91,18 @@ jobs:
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
if [ "${{ matrix.setup-method }}" = ghcup ]; then
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
else
apt-add-repository -y 'ppa:hvr/ghc'
apt-get update
apt-get install -y "$HCNAME"
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
env:
HCKIND: ${{ matrix.compilerKind }}
Expand All @@ -117,13 +122,13 @@ jobs:
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
else
HC=$HCDIR/bin/$HCKIND
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
fi
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
Expand Down Expand Up @@ -182,7 +187,7 @@ jobs:
chmod a+x $HOME/.cabal/bin/cabal-plan
cabal-plan --version
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: source
- name: initial cabal.project for sdist
Expand Down Expand Up @@ -210,15 +215,15 @@ jobs:
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(haskell-src-meta)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(haskell-src-meta)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
run: |
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
cabal-plan
- name: restore cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
Expand Down Expand Up @@ -248,7 +253,7 @@ jobs:
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: save cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: always()
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
Expand Down
3 changes: 3 additions & 0 deletions haskell-src-meta/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.8.14
- Support for GHC 9.10 (by Troels Henriksen)

0.8.13
- Support for GHC 9.8 (by Vladislav Zavialov)

Expand Down
4 changes: 2 additions & 2 deletions haskell-src-meta/haskell-src-meta.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ author: Matt Morrow
copyright: (c) Matt Morrow
maintainer: [email protected]
bug-reports: https://github.com/haskell-party/haskell-src-meta/issues
tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.2, GHC == 9.4.1, GHC == 9.6.1, GHC == 9.8.1
tested-with: GHC == 8.2.2, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.4, GHC == 8.10.7, GHC == 9.0.2, GHC == 9.2.2, GHC == 9.4.1, GHC == 9.6.1, GHC == 9.8.1, GHC == 9.10.1
synopsis: Parse source to template-haskell abstract syntax.
description: The translation from haskell-src-exts abstract syntax
to template-haskell abstract syntax isn't 100% complete yet.
Expand All @@ -22,7 +22,7 @@ library
haskell-src-exts >= 1.21 && < 1.24,
pretty >= 1.0 && < 1.2,
syb >= 0.1 && < 0.8,
template-haskell >= 2.12 && < 2.22,
template-haskell >= 2.12 && < 2.23,
th-orphans >= 0.12 && < 0.14

hs-source-dirs: src
Expand Down
7 changes: 7 additions & 0 deletions haskell-src-meta/src/Language/Haskell/Meta/Extensions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,13 @@ fromExtension e = case e of
TH.ExtendedLiterals -> Nothing
#endif

-- 2.22.0 ---------------------------------------

#if MIN_VERSION_template_haskell(2,22,0)
TH.RequiredTypeArguments -> Nothing
TH.ListTuplePuns -> Nothing
#endif

-- NB: when adding a case here, you may also need to update `toExtension`


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,11 @@ instance ToDecs (Exts.Decl l) where
toDecs (Exts.InfixDecl l assoc Nothing ops) =
toDecs (Exts.InfixDecl l assoc (Just 9) ops)
toDecs (Exts.InfixDecl _ assoc (Just fixity) ops) =
#if MIN_VERSION_template_haskell(2,22,0)
map (\op -> TH.InfixD (TH.Fixity fixity dir) TH.NoNamespaceSpecifier (toName op)) ops
#else
map (\op -> TH.InfixD (TH.Fixity fixity dir) (toName op)) ops
#endif
where
dir = case assoc of
Exts.AssocNone _ -> TH.InfixN
Expand Down

0 comments on commit d53113b

Please sign in to comment.