Skip to content

Commit

Permalink
Require building with singletons-base-3.5/GHC 9.12
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGlScott committed Dec 30, 2024
1 parent a3d2b24 commit 2e63099
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
40 changes: 23 additions & 17 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.19.20240514
# version: 0.19.20241222
#
# REGENDATA ("0.19.20240514",["github","cabal.project"])
# REGENDATA ("0.19.20241222",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand All @@ -28,22 +28,37 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.10.1
- compiler: ghc-9.12.1
compilerKind: ghc
compilerVersion: 9.10.1
compilerVersion: 9.12.1
setup-method: ghcup
allow-failure: false
fail-fast: false
steps:
- name: apt
- name: apt-get install
run: |
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
- name: Install GHCup
run: |
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.30.0/x86_64-linux-ghcup-0.1.30.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
- name: Install cabal-install (prerelease)
run: |
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml;
"$HOME/.ghcup/bin/ghcup" install cabal 3.15.0.0.2024.10.3 || (cat "$HOME"/.ghcup/logs/*.* && false)
echo "CABAL=$HOME/.ghcup/bin/cabal-3.15.0.0.2024.10.3 -vnormal+nowrap" >> "$GITHUB_ENV"
- name: Install GHC (GHCup)
if: matrix.setup-method == 'ghcup'
run: |
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
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=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand All @@ -54,21 +69,12 @@ jobs:
echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
HCDIR=/opt/$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=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
echo "GHCJSARITH=0" >> "$GITHUB_ENV"
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand Down Expand Up @@ -179,8 +185,8 @@ jobs:
run: |
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
- name: save cache
uses: actions/cache/save@v4
if: always()
uses: actions/cache/save@v4
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
12 changes: 6 additions & 6 deletions singleton-gadts.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ category: Dependent Types
build-type: Simple
extra-source-files: CHANGELOG.md, README.md
cabal-version: >=1.10
tested-with: GHC == 9.10.1
tested-with: GHC == 9.12.1

source-repository head
type: git
Expand All @@ -39,20 +39,20 @@ library
Data.Singletons.GADT.Prelude
Data.Singletons.GADT.TH
other-modules: Data.Singletons.GADT.Internal
build-depends: base >= 4.20 && < 4.21
, singletons-base >= 3.4 && < 3.5
build-depends: base >= 4.21 && < 4.22
, singletons-base >= 3.5 && < 3.6
, singleton-nats >= 0.4.2 && < 0.5
, template-haskell >= 2.22 && < 2.23
, template-haskell >= 2.23 && < 2.24
, text >= 2.0.1 && < 2.2
, th-desugar >= 1.17 && < 1.18
, th-desugar >= 1.18 && < 1.19
hs-source-dirs: src
default-language: GHC2021
ghc-options: -Wall -Wcompat -Wno-unticked-promoted-constructors -fenable-th-splice-warnings

test-suite test
type: exitcode-stdio-1.0
main-is: Main.hs
build-depends: base >= 4.20 && < 4.21
build-depends: base >= 4.21 && < 4.22
, singleton-gadts
, singleton-nats >= 0.4.2 && < 0.5
hs-source-dirs: tests
Expand Down
7 changes: 3 additions & 4 deletions src/Data/Singletons/GADT/TH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,13 @@ singDataD name tvbs ctors = do
mkEmptyFromSingClause = do
x <- qNewName "x"
pure $ DClause [DVarP x]
$ DCaseE (DVarE x) []
$ dCaseE (DVarE x) []

mkEmptyToSingClause :: q DClause
mkEmptyToSingClause = do
x <- qNewName "x"
pure $ DClause [DVarP x]
$ DConE 'SomeSing `DAppE` DCaseE (DVarE x) []
$ DConE 'SomeSing `DAppE` dCaseE (DVarE x) []

-- | Make a constraint tuple 'DType' from a list of 'DType's. Avoids using a 1-tuple.
mkTupleDType :: [DType] -> DType
Expand All @@ -340,8 +340,7 @@ mkTupleDType tys = foldl DAppT (DConT $ tupleTypeName (length tys)) tys
-- build a pattern match over several expressions, each with only one pattern
multiCase :: [DExp] -> [DPat] -> DExp -> DExp
multiCase [] [] body = body
multiCase scruts pats body =
DCaseE (mkTupleDExp scruts) [DMatch (mkTupleDPat pats) body]
multiCase scruts pats body = dCasesE scruts [DClause pats body]

tysOfConFields :: DConFields -> [DType]
tysOfConFields (DNormalC _ stys) = map snd stys
Expand Down

0 comments on commit 2e63099

Please sign in to comment.