diff options
-rw-r--r-- | cabal-helper.cabal | 4 | ||||
-rw-r--r-- | cabal.project | 4 | ||||
-rw-r--r-- | src/CabalHelper/Compiletime/Data.hs | 14 | ||||
-rw-r--r-- | tests/CompileTest.hs | 4 |
4 files changed, 20 insertions, 6 deletions
diff --git a/cabal-helper.cabal b/cabal-helper.cabal index 90a6d1f..3c24b86 100644 --- a/cabal-helper.cabal +++ b/cabal-helper.cabal @@ -98,7 +98,7 @@ common build-deps , semigroupoids < 5.4 && >= 5.2 , SHA < 1.7 && >= 1.6.4.4 , text < 1.3 && >= 1.0.0.0 - , template-haskell < 2.16 && >= 2.11.1.0 + , template-haskell < 2.17 && >= 2.11.1.0 , temporary < 1.3 && >= 1.2.1 , time < 1.10 && >= 1.6.0.1 , transformers < 0.6 && >= 0.5.2.0 @@ -193,7 +193,7 @@ test-suite ghc-session other-modules: TestOptions hs-source-dirs: tests ghc-options: -Wall -fwarn-incomplete-uni-patterns - build-depends: ghc < 8.9 && >= 8.0.2 + build-depends: ghc < 8.11 && >= 8.0.2 , pretty-show < 1.9 && >= 1.8.1 test-suite examples diff --git a/cabal.project b/cabal.project index e6fdbad..ef33aa3 100644 --- a/cabal.project +++ b/cabal.project @@ -1 +1,5 @@ packages: . + +-- Remove when cabal-plan supports ghc-8.10.1 +-- see https://github.com/haskell-hvr/cabal-plan/issues/54 +allow-newer: cabal-plan:base
\ No newline at end of file diff --git a/src/CabalHelper/Compiletime/Data.hs b/src/CabalHelper/Compiletime/Data.hs index 3533aa7..9586c77 100644 --- a/src/CabalHelper/Compiletime/Data.hs +++ b/src/CabalHelper/Compiletime/Data.hs @@ -9,7 +9,7 @@ -- -- http://www.apache.org/licenses/LICENSE-2.0 -{-# LANGUAGE TemplateHaskell, ScopedTypeVariables #-} +{-# LANGUAGE TemplateHaskell, ScopedTypeVariables, CPP #-} {-# OPTIONS_GHC -fforce-recomp #-} {-| @@ -90,11 +90,19 @@ runtimeSources = $( let hashes = map (bytestringDigest . sha256) contents let top_hash = showDigest $ sha256 $ LBS.concat hashes + let exprWrapper = +#if MIN_VERSION_template_haskell(2,16,0) + Just +#else + id +#endif + + thfiles <- forM (map fst files `zip` contents) $ \(f, xs) -> do - return $ TupE [LitE (StringL f), LitE (StringL (LUTF8.toString xs))] + return $ TupE [exprWrapper (LitE (StringL f)), exprWrapper (LitE (StringL (LUTF8.toString xs)))] - return $ TupE [LitE (StringL top_hash), ListE thfiles] + return $ TupE [exprWrapper (LitE (StringL top_hash)), exprWrapper (ListE thfiles)] ) diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs index 77698c5..8f79868 100644 --- a/tests/CompileTest.hs +++ b/tests/CompileTest.hs @@ -100,7 +100,8 @@ allCabalVersions (GhcVersion ghc_ver) = do <- map parseVer . lines <$> readFile "tests/cabal-versions" let constraint :: VersionRange - Just constraint = + constraint = + fromMaybe (error $ "No cabal version constraint found for " ++ show ghc_ver) $ fmap snd $ find (and . (zipWith (==) `on` versionBranch) ghc_ver . fst) $ constraint_table @@ -116,6 +117,7 @@ allCabalVersions (GhcVersion ghc_ver) = do , ("8.4", ">= 2.0.0.2 ") , ("8.6", ">= 2.0.0.2 ") , ("8.8", ">= 3.0.0.0 ") + , ("8.10", ">= 3.2.0.0 ") ] return $ reverse $ map (flip withinRange'CH constraint &&& id) cabal_versions |