From 5ae2e4a4c75e314d80f0bde52483653dea9d207a Mon Sep 17 00:00:00 2001 From: jneira Date: Thu, 16 Apr 2020 15:02:54 +0200 Subject: Support GHC 8.10 --- src/CabalHelper/Compiletime/Data.hs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/CabalHelper') 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)] ) -- cgit v1.2.3