From 084cea93906db25691c716671870990eb385c2f3 Mon Sep 17 00:00:00 2001 From: Marcin Szamotulski Date: Mon, 27 Mar 2023 09:40:14 +0200 Subject: [PATCH] Build with `ghc-9.6` --- .github/workflows/ci.yml | 7 ++++++- nothunks.cabal | 4 ++-- src/NoThunks/Class.hs | 6 ++++-- test/Test/NoThunks/Class.hs | 5 +++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c5bfda..3a7ad4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ghc: ["8.10.7", "9.0.2", "9.2.4", "9.4.2"] + ghc: ["8.10.7", "9.0.2", "9.2.4", "9.4.2", "9.6.1"] env: CONFIG: "--enable-tests" steps: @@ -24,6 +24,11 @@ jobs: ghc-version: ${{ matrix.ghc }} cabal-version: 3.6.2.0 - run: cabal update + # TODO: remove once hedgehog is compatible with ghc-9.6 + - name: "Support ghc-9.6" + if: matrix.ghc == '9.6.1' + run: | + echo "allow-newer: hedgehog:template-haskell" >> cabal.project.local - run: cabal freeze $CONFIG - uses: actions/cache@v2 with: diff --git a/nothunks.cabal b/nothunks.cabal index 04e4ed1..179ebcd 100644 --- a/nothunks.cabal +++ b/nothunks.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.4 +cabal-version: 3.0 name: nothunks version: 0.1.3 synopsis: Examine values for unexpected thunks @@ -15,7 +15,7 @@ maintainer: operations@iohk.io copyright: 2018-2021 IOHK category: Development extra-source-files: CHANGELOG.md -tested-with: GHC==8.10.7, GHC==9.0.2, GHC==9.2.4, GHC==9.4.2 +tested-with: GHC== { 8.10.7, 9.0.2, 9.2.4, 9.4.2, 9.6.1 } source-repository head type: git diff --git a/src/NoThunks/Class.hs b/src/NoThunks/Class.hs index 8d23659..34fa282 100644 --- a/src/NoThunks/Class.hs +++ b/src/NoThunks/Class.hs @@ -202,8 +202,10 @@ data ThunkInfo = ThunkInfo { -- > --------------------------------------------------------------------- -- > ["(,)"] the pair itself -- > ["Int","(,)"] the Int in the pair - -- > ["[]","(,)"] the [Int] in the pair - -- > ["Int","[]","(,)"] an Int in the [Int] in the pair + -- > ["List","(,)"] the [Int] in the pair + -- > ["Int","List","(,)"] an Int in the [Int] in the pair + -- + -- Note: prior to `ghc-9.6` a list was indicated by `[]`. thunkContext :: Context } deriving (Show) diff --git a/test/Test/NoThunks/Class.hs b/test/Test/NoThunks/Class.hs index a3f4cd7..f42a87f 100644 --- a/test/Test/NoThunks/Class.hs +++ b/test/Test/NoThunks/Class.hs @@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} @@ -241,7 +242,11 @@ instance FromModel a => FromModel [a] where ListNil -> IsNF ListCons x xs' -> constrNF [modelIsNF ctxt' x, modelIsNF ctxt xs'] where +#if MIN_VERSION_GLASGOW_HASKELL(9,6,0,0) + ctxt' = "List" : ctxt +#else ctxt' = "[]" : ctxt +#endif fromModel (ListThunk xs) k = fromModel xs $ \xs' -> k (if ack 3 3 > 0 then xs' else xs') fromModel ListNil k = k []