Skip to content

Commit

Permalink
singletons-{th,base}: Require building with GHC 9.4
Browse files Browse the repository at this point in the history
This patch:

* Allows `singletons` to build with GHC 9.4
* Requires `singletons-th` and `singletons-base` to build with GHC 9.4
* Updates the golden tests accordingly
  • Loading branch information
RyanGlScott committed Aug 23, 2022
1 parent a58eb76 commit 467a9af
Show file tree
Hide file tree
Showing 50 changed files with 309 additions and 319 deletions.
57 changes: 31 additions & 26 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.13.20211116
# version: 0.15.20220822
#
# REGENDATA ("0.13.20211116",["github","cabal.project"])
# REGENDATA ("0.15.20220822",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -19,7 +19,7 @@ on:
jobs:
linux:
name: Haskell-CI - Linux - ${{ matrix.compiler }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
timeout-minutes:
60
container:
Expand All @@ -33,15 +33,20 @@ jobs:
compilerVersion: "8.4"
setup-method: hvr-ppa
allow-failure: false
- compiler: ghc-9.2.1
- compiler: ghc-9.4.1
compilerKind: ghc
compilerVersion: 9.2.1
compilerVersion: 9.4.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.1
- compiler: ghc-9.2.4
compilerKind: ghc
compilerVersion: 9.0.1
setup-method: hvr-ppa
compilerVersion: 9.2.4
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.0.2
compilerKind: ghc
compilerVersion: 9.0.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.10.7
compilerKind: ghc
Expand Down Expand Up @@ -94,10 +99,10 @@ 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.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
else
apt-add-repository -y 'ppa:hvr/ghc'
if [ $((GHCJSARITH)) -ne 0 ] ; then apt-add-repository -y 'ppa:hvr/ghcjs' ; fi
Expand All @@ -106,9 +111,9 @@ 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.17.3/x86_64-linux-ghcup-0.1.17.3 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.18.0/x86_64-linux-ghcup-0.1.18.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
env:
HCKIND: ${{ matrix.compilerKind }}
Expand Down Expand Up @@ -200,8 +205,8 @@ jobs:
run: |
touch cabal.project
echo "packages: $GITHUB_WORKSPACE/source/./singletons" >> cabal.project
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-th" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-base" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-th" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "packages: $GITHUB_WORKSPACE/source/./singletons-base" >> cabal.project ; fi
cat cabal.project
- name: sdist
run: |
Expand All @@ -223,19 +228,19 @@ jobs:
touch cabal.project
touch cabal.project.local
echo "packages: ${PKGDIR_singletons}" >> cabal.project
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_th}" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_base}" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "packages: ${PKGDIR_singletons_th}" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -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 >= 90200)) -ne 0 ] ; then echo "package singletons-th" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then echo "package singletons-base" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "package singletons-th" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then echo "package singletons-base" >> cabal.project ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -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: b2b9db81d26dc767e7eb4481b7f20cfae6fa0eda
tag: 26c48f73b7bae8a446b7a8daf226c98bb55d7479
EOF
$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
Expand Down Expand Up @@ -264,10 +269,10 @@ jobs:
run: |
cd ${PKGDIR_singletons} || false
${CABAL} -vnormal check
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then cd ${PKGDIR_singletons_th} || false ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then cd ${PKGDIR_singletons_base} || false ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90200)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then cd ${PKGDIR_singletons_th} || false ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then cd ${PKGDIR_singletons_base} || false ; fi
if [ $((! GHCJSARITH && HCNUMVER >= 90400)) -ne 0 ] ; then ${CABAL} -vnormal check ; fi
- name: haddock
run: |
if [ $((! GHCJSARITH)) -ne 0 ] ; then $CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all ; fi
2 changes: 1 addition & 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.2).
(currently GHC 9.4).

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 Down
2 changes: 2 additions & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ distribution: bionic
no-tests-no-benchmarks: False
unconstrained: False
jobs-selection: any
-- Needed to avoid https://github.com/haskell/cabal/issues/5423
haddock-components: libs
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ packages: ./singletons
source-repository-package
type: git
location: https://github.com/goldfirere/th-desugar
tag: b2b9db81d26dc767e7eb4481b7f20cfae6fa0eda
tag: b64e24b67c91991f5d9b97b055d05693fd99cb9b
4 changes: 4 additions & 0 deletions singletons-base/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog for the `singletons-base` project
===========================================

3.1.1 [????.??.??]
------------------
* Require building with GHC 9.4.

3.1 [2021.10.30]
----------------
* Require building with GHC 9.2.
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.2). For more information,
of GHC (currently GHC 9.4). For more information,
consult the `singletons`
[`README`](https://github.com/goldfirere/singletons/blob/master/README.md).

Expand Down
20 changes: 10 additions & 10 deletions singletons-base/singletons-base.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: singletons-base
version: 3.1
version: 3.1.1
cabal-version: 1.24
synopsis: A promoted and singled version of the base library
homepage: http://www.github.com/goldfirere/singletons
Expand All @@ -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.2.1
tested-with: GHC == 9.4.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.2). For more information,
of GHC (currently GHC 9.4). For more information,
consult the @singletons@
@<https://github.com/goldfirere/singletons/blob/master/README.md README>@.
.
Expand All @@ -65,20 +65,20 @@ source-repository head

custom-setup
setup-depends:
base >= 4.16 && < 4.17,
Cabal >= 3.0 && < 3.7,
base >= 4.17 && < 4.18,
Cabal >= 3.0 && < 3.9,
directory >= 1,
filepath >= 1.3

library
hs-source-dirs: src
build-depends: base >= 4.16 && < 4.17,
build-depends: base >= 4.17 && < 4.18,
pretty,
singletons == 3.0.1,
singletons == 3.0.*,
singletons-th == 3.1.*,
template-haskell >= 2.18 && < 2.19,
template-haskell >= 2.19 && < 2.20,
text >= 1.2,
th-desugar >= 1.13 && < 1.14
th-desugar >= 1.14 && < 1.15
default-language: GHC2021
other-extensions: TemplateHaskell
exposed-modules: Data.Singletons.Base.CustomStar
Expand Down Expand Up @@ -153,7 +153,7 @@ test-suite singletons-base-test-suite
main-is: SingletonsBaseTestSuite.hs
other-modules: SingletonsBaseTestSuiteUtils

build-depends: base >= 4.16 && < 4.17,
build-depends: base >= 4.17 && < 4.18,
bytestring >= 0.10.9,
deepseq >= 1.4.4,
filepath >= 1.3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ Singletons/AsPattern.hs:(0,0)-(0,0): Splicing declarations
sing = (singFun1 @BarSym0) sBar
instance SingI (MaybePlusSym0 :: (~>) (Maybe Nat) (Maybe Nat)) where
sing = (singFun1 @MaybePlusSym0) sMaybePlus
data SBaz :: Baz -> GHC.Types.Type
data SBaz :: Baz -> Type
where
SBaz :: forall (n :: Nat) (n :: Nat) (n :: Nat).
(Sing n) -> (Sing n) -> (Sing n) -> SBaz (Baz n n n :: Baz)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Singletons/BoxUnBox.hs:(0,0)-(0,0): Splicing declarations
sUnBox (SFBox (sA :: Sing a)) = sA
instance SingI (UnBoxSym0 :: (~>) (Box a) a) where
sing = (singFun1 @UnBoxSym0) sUnBox
data SBox :: forall a. Box a -> GHC.Types.Type
data SBox :: forall a. Box a -> Type
where
SFBox :: forall a (n :: a). (Sing n) -> SBox (FBox n :: Box a)
type instance Sing @(Box a) = SBox
Expand Down
10 changes: 5 additions & 5 deletions singletons-base/tests/compile-and-dump/Singletons/Classes.golden
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ Singletons/Classes.hs:(0,0)-(0,0): Splicing declarations
instance SingI1 (ConstSym1 :: a -> (~>) b a) where
liftSing (s :: Sing (d :: a))
= (singFun1 @(ConstSym1 (d :: a))) (sConst s)
data SFoo :: Foo -> GHC.Types.Type
data SFoo :: Foo -> Type
where
SA :: SFoo (A :: Foo)
SB :: SFoo (B :: Foo)
Expand All @@ -335,7 +335,7 @@ Singletons/Classes.hs:(0,0)-(0,0): Splicing declarations
fromSing SB = B
toSing A = SomeSing SA
toSing B = SomeSing SB
data SFoo2 :: Foo2 -> GHC.Types.Type
data SFoo2 :: Foo2 -> Type
where
SF :: SFoo2 (F :: Foo2)
SG :: SFoo2 (G :: Foo2)
Expand Down Expand Up @@ -402,7 +402,7 @@ Singletons/Classes.hs:(0,0)-(0,0): Splicing declarations
forall (t1 :: Foo2) (t2 :: Foo2). Sing t1
-> Sing t2
-> Sing (Apply (Apply ((==@#@$) :: TyFun Foo2 ((~>) Foo2 Bool)
-> GHC.Types.Type) t1) t2)
-> Type) t1) t2)
(%==) SF SF = STrue
(%==) SG SG = STrue
(%==) SF SG = SFalse
Expand Down Expand Up @@ -571,7 +571,7 @@ Singletons/Classes.hs:(0,0)-(0,0): Splicing declarations
Mycompare_0123456789876543210Sym2 a0123456789876543210 a0123456789876543210 = Mycompare_0123456789876543210 a0123456789876543210 a0123456789876543210
instance PMyOrd Nat' where
type Mycompare a a = Apply (Apply Mycompare_0123456789876543210Sym0 a) a
data SNat' :: Nat' -> GHC.Types.Type
data SNat' :: Nat' -> Type
where
SZero' :: SNat' (Zero' :: Nat')
SSucc' :: forall (n :: Nat'). (Sing n) -> SNat' (Succ' n :: Nat')
Expand All @@ -589,7 +589,7 @@ Singletons/Classes.hs:(0,0)-(0,0): Splicing declarations
forall (t :: Nat') (t :: Nat'). Sing t
-> Sing t
-> Sing (Apply (Apply (MycompareSym0 :: TyFun Nat' ((~>) Nat' Ordering)
-> GHC.Types.Type) t) t)
-> Type) t) t)
sMycompare SZero' SZero' = SEQ
sMycompare SZero' (SSucc' _) = SLT
sMycompare (SSucc' _) SZero' = SGT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Singletons/Classes2.hs:(0,0)-(0,0): Splicing declarations
Mycompare_0123456789876543210Sym2 a0123456789876543210 a0123456789876543210 = Mycompare_0123456789876543210 a0123456789876543210 a0123456789876543210
instance PMyOrd NatFoo where
type Mycompare a a = Apply (Apply Mycompare_0123456789876543210Sym0 a) a
data SNatFoo :: NatFoo -> GHC.Types.Type
data SNatFoo :: NatFoo -> Type
where
SZeroFoo :: SNatFoo (ZeroFoo :: NatFoo)
SSuccFoo :: forall (n :: NatFoo).
Expand All @@ -78,7 +78,7 @@ Singletons/Classes2.hs:(0,0)-(0,0): Splicing declarations
forall (t1 :: NatFoo) (t2 :: NatFoo). Sing t1
-> Sing t2
-> Sing (Apply (Apply (MycompareSym0 :: TyFun NatFoo ((~>) NatFoo Ordering)
-> GHC.Types.Type) t1) t2)
-> Type) t1) t2)
sMycompare SZeroFoo SZeroFoo = SEQ
sMycompare SZeroFoo (SSuccFoo _) = SLT
sMycompare (SSuccFoo _) SZeroFoo = SGT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Singletons/DataValues.hs:(0,0)-(0,0): Splicing declarations
((applySing ((singFun2 @PairSym0) SPair))
((applySing ((singFun1 @SuccSym0) SSucc)) SZero)))
((applySing ((applySing ((singFun2 @(:@#@$)) SCons)) SZero)) SNil)
data SPair :: forall a b. Pair a b -> GHC.Types.Type
data SPair :: forall a b. Pair a b -> Type
where
SPair :: forall a b (n :: a) (n :: b).
(Sing n) -> (Sing n) -> SPair (Pair n n :: Pair a b)
Expand All @@ -141,7 +141,7 @@ Singletons/DataValues.hs:(0,0)-(0,0): Splicing declarations
-> Sing t2
-> Sing t3
-> Sing (Apply (Apply (Apply (ShowsPrecSym0 :: TyFun GHC.Num.Natural.Natural ((~>) (Pair a b) ((~>) Symbol Symbol))
-> GHC.Types.Type) t1) t2) t3)
-> Type) t1) t2) t3)
sShowsPrec
(sP_0123456789876543210 :: Sing p_0123456789876543210)
(SPair (sArg_0123456789876543210 :: Sing arg_0123456789876543210)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Singletons/Empty.hs:(0,0)-(0,0): Splicing declarations
singletons [d| data Empty |]
======>
data Empty
data SEmpty :: Empty -> GHC.Types.Type
data SEmpty :: Empty -> Type
type instance Sing @Empty = SEmpty
instance SingKind Empty where
type Demote Empty = Empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Singletons/EmptyShowDeriving.hs:(0,0)-(0,0): Splicing declarations
ShowsPrec_0123456789876543210Sym3 a0123456789876543210 a0123456789876543210 a0123456789876543210 = ShowsPrec_0123456789876543210 a0123456789876543210 a0123456789876543210 a0123456789876543210
instance PShow Foo where
type ShowsPrec a a a = Apply (Apply (Apply ShowsPrec_0123456789876543210Sym0 a) a) a
data SFoo :: Foo -> GHC.Types.Type
data SFoo :: Foo -> Type
type instance Sing @Foo = SFoo
instance SingKind Foo where
type Demote Foo = Foo
Expand All @@ -60,7 +60,7 @@ Singletons/EmptyShowDeriving.hs:(0,0)-(0,0): Splicing declarations
-> Sing t2
-> Sing t3
-> Sing (Apply (Apply (Apply (ShowsPrecSym0 :: TyFun GHC.Num.Natural.Natural ((~>) Foo ((~>) GHC.Types.Symbol GHC.Types.Symbol))
-> GHC.Types.Type) t1) t2) t3)
-> Type) t1) t2) t3)
sShowsPrec
_
(sV_0123456789876543210 :: Sing v_0123456789876543210)
Expand Down
Loading

0 comments on commit 467a9af

Please sign in to comment.