Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

singletons-{th,base}: Require building with GHC 9.8 #575

Merged
merged 5 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
62 changes: 42 additions & 20 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.16.6
# version: 0.17.20231010
#
# REGENDATA ("0.16.6",["github","cabal.project"])
# REGENDATA ("0.17.20231010",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -33,6 +33,11 @@ jobs:
compilerVersion: "8.4"
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-9.8.1
compilerKind: ghc
compilerVersion: 9.8.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.6.2
compilerKind: ghc
compilerVersion: 9.6.2
Expand Down Expand Up @@ -104,7 +109,7 @@ 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.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$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)
Expand All @@ -116,7 +121,7 @@ jobs:
apt-get update
if [ $((GHCJSARITH)) -ne 0 ] ; then apt-get install -y "$HCNAME" ghc-8.4.4 nodejs ; else apt-get install -y "$HCNAME" ; fi
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$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)
fi
Expand All @@ -133,10 +138,12 @@ jobs:
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
HCDIR=/opt/$HCKIND/$HCVER
if [ "${{ matrix.setup-method }}" = ghcup ]; then
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$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"
else
HC=$HCDIR/bin/$HCKIND
Expand All @@ -150,7 +157,7 @@ jobs:
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo "HEADHACKAGE=true" >> "$GITHUB_ENV" ; else echo "HEADHACKAGE=false" >> "$GITHUB_ENV" ; fi
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
env:
HCKIND: ${{ matrix.compilerKind }}
Expand Down Expand Up @@ -178,6 +185,18 @@ jobs:
repository hackage.haskell.org
url: http://hackage.haskell.org/
EOF
if $HEADHACKAGE; then
cat >> $CABAL_CONFIG <<EOF
repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
key-threshold: 3
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org:override
EOF
fi
cat >> $CABAL_CONFIG <<EOF
program-default-options
ghc-options: $GHCJOBS +RTS -M3G -RTS
Expand Down Expand Up @@ -210,8 +229,8 @@ jobs:
run: |
touch cabal.project
echo "packages: $GITHUB_WORKSPACE/source/./singletons" >> cabal.project
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-th" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-base" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-th" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-base" >> cabal.project ; fi
cat cabal.project
- name: sdist
run: |
Expand All @@ -233,20 +252,23 @@ jobs:
touch cabal.project
touch cabal.project.local
echo "packages: ${PKGDIR_singletons}" >> cabal.project
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_th}" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_base}" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_th}" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_base}" >> cabal.project ; fi
if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo "package singletons" >> cabal.project ; fi
if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "package singletons-th" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo "package singletons-base" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo "package singletons-th" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo "package singletons-base" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
cat >> cabal.project <<EOF
source-repository-package
type: git
location: https://github.com/goldfirere/th-desugar
tag: 47f6221088ac6185566066b4d45909b0cc704855
EOF
if $HEADHACKAGE; then
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project
fi
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(singletons|singletons-base|singletons-th)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
Expand Down Expand Up @@ -274,10 +296,10 @@ jobs:
run: |
cd ${PKGDIR_singletons} || false
${CABAL} -vnormal check
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then cd ${PKGDIR_singletons_th} || false ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then cd ${PKGDIR_singletons_base} || false ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90600)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then cd ${PKGDIR_singletons_th} || false ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then cd ${PKGDIR_singletons_base} || false ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90800)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi
- name: haddock
run: |
if [ $((! GHCJSARITH)) -ne 0 ] ; then $CABAL v2-haddock --disable-documentation $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ windows for requirements on the compiler version needed to build each library:
GHC language extensions, even more so than `singletons` itself. As such, it
is difficult to maintain support for multiple GHC versions in any given
release of either library, so they only support the latest major GHC version
(currently GHC 9.6).
(currently GHC 9.8).

Any code that uses the singleton-generation functionality from `singletons-th`
or `singletons-base` needs to enable a long list of GHC extensions. This list
Expand All @@ -89,6 +89,7 @@ includes, but is not necessarily limited to, the following:
* `StandaloneDeriving`
* `StandaloneKindSignatures`
* `TemplateHaskell`
* `TypeAbstractions`
* `TypeApplications`
* `TypeFamilies`
* `TypeOperators`
Expand Down Expand Up @@ -834,6 +835,7 @@ The following constructs are fully supported:
* signatures (e.g., `(x :: Maybe a)`) in expressions
* `InstanceSigs`
* `TypeData`
* `TypeAbstractions`

## Partial support

Expand Down
2 changes: 2 additions & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ unconstrained: False
jobs-selection: any
-- Needed to avoid https://github.com/haskell/cabal/issues/5423
haddock-components: libs
-- Temporarily use head.hackage for GHC 9.8 until the ecosystem catches up
head-hackage: >= 9.8
1 change: 1 addition & 0 deletions singletons-base/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changelog for the `singletons-base` project

next [????.??.??]
-----------------
* Require building with GHC 9.8.
* All singleton types with `SEq` or `SOrd` instances now have `Eq` or `Ord`
instances of the form:

Expand Down
2 changes: 1 addition & 1 deletion singletons-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ that code with `singletons-base`.

`singletons-base` uses code that relies on bleeding-edge GHC language
extensions. As such, `singletons-base` only supports the latest major version
of GHC (currently GHC 9.6). For more information,
of GHC (currently GHC 9.8). For more information,
consult the `singletons`
[`README`](https://github.com/goldfirere/singletons/blob/master/README.md).

Expand Down
14 changes: 7 additions & 7 deletions singletons-base/singletons-base.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ author: Richard Eisenberg <[email protected]>, Jan Stolarek <jan.stola
maintainer: Ryan Scott <[email protected]>
bug-reports: https://github.com/goldfirere/singletons/issues
stability: experimental
tested-with: GHC == 9.6.2
tested-with: GHC == 9.8.1
extra-source-files: README.md, CHANGES.md, tests/README.md,
tests/compile-and-dump/GradingClient/*.hs,
tests/compile-and-dump/InsertionSort/*.hs,
Expand Down Expand Up @@ -38,7 +38,7 @@ description:
.
@singletons-base@ uses code that relies on bleeding-edge GHC language
extensions. As such, @singletons-base@ only supports the latest major version
of GHC (currently GHC 9.6). For more information,
of GHC (currently GHC 9.8). For more information,
consult the @singletons@
@<https://github.com/goldfirere/singletons/blob/master/README.md README>@.
.
Expand All @@ -65,18 +65,18 @@ source-repository head

custom-setup
setup-depends:
base >= 4.18 && < 4.19,
Cabal >= 3.0 && < 3.11,
base >= 4.19 && < 4.20,
Cabal >= 3.0 && < 3.13,
directory >= 1,
filepath >= 1.3

library
hs-source-dirs: src
build-depends: base >= 4.18 && < 4.19,
build-depends: base >= 4.19 && < 4.20,
pretty,
singletons == 3.0.*,
singletons-th >= 3.2 && < 3.3,
template-haskell >= 2.20 && < 2.21,
template-haskell >= 2.21 && < 2.22,
text >= 1.2,
th-desugar >= 1.16 && < 1.17
default-language: GHC2021
Expand Down Expand Up @@ -155,7 +155,7 @@ test-suite singletons-base-test-suite
main-is: SingletonsBaseTestSuite.hs
other-modules: SingletonsBaseTestSuiteUtils

build-depends: base >= 4.18 && < 4.19,
build-depends: base >= 4.19 && < 4.20,
bytestring >= 0.10.9,
deepseq >= 1.4.4,
filepath >= 1.3,
Expand Down
1 change: 1 addition & 0 deletions singletons-base/tests/SingletonsBaseTestSuite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ tests =
, compileAndDumpStdTest "T559"
, compileAndDumpStdTest "T567"
, compileAndDumpStdTest "T571"
, compileAndDumpStdTest "TypeAbstractions"
],
testCompileAndDumpGroup "Promote"
[ compileAndDumpStdTest "Constructors"
Expand Down
1 change: 1 addition & 0 deletions singletons-base/tests/SingletonsBaseTestSuiteUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ ghcOpts = ghcFlags ++ [
, "-XCPP"
, "-XNoStarIsType"
, "-XNoNamedWildCards"
, "-XTypeAbstractions"
]

-- Compile a test using specified GHC options. Save output to file, normalize
Expand Down
12 changes: 6 additions & 6 deletions singletons-base/tests/compile-and-dump/GradingClient/Database.hs
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,12 @@ readRow id (SSch (SCons (SAttr _ u) at)) (sh:st) = do
(rowTail, strTail) <- readRow id (SSch at) st
case elUReadInstance u of
ElUReadInstance ->
let results = readsPrec 0 sh in
if null results
then throwError $ "No parse of " ++ sh ++ " as a " ++
(show (fromSing u))
else
let item = fst $ head results in
case readsPrec 0 sh of
[] ->
throwError $ "No parse of " ++ sh ++ " as a " ++
(show (fromSing u))
result:_ ->
let item = fst result in
case elUShowInstance u of
ElUShowInstance -> return (ConsRow item rowTail, strTail)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Singletons/T342.hs:(0,0)-(0,0): Splicing declarations
do synName <- newName "MyId"
a <- newName "a"
let dsyn = DTySynD synName [DPlainTV a ()] (DVarT a)
let dsyn = DTySynD synName [DPlainTV a BndrReq] (DVarT a)
syn = decToTH dsyn
defuns <- withLocalDeclarations [syn] $ genDefunSymbols [synName]
pure $ syn : defuns
Expand Down
2 changes: 1 addition & 1 deletion singletons-base/tests/compile-and-dump/Singletons/T342.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Language.Haskell.TH.Desugar

$(do synName <- newName "MyId"
a <- newName "a"
let dsyn = DTySynD synName [DPlainTV a ()] (DVarT a)
let dsyn = DTySynD synName [DPlainTV a BndrReq] (DVarT a)
syn = decToTH dsyn
defuns <- withLocalDeclarations [syn] $
genDefunSymbols [synName]
Expand Down
Loading