From 14fb430d8c33948598226af83c120e02bb36ce32 Mon Sep 17 00:00:00 2001 From: Teo Camarasu Date: Tue, 21 Jan 2025 17:25:52 +0000 Subject: [PATCH] Switch from template-haskell to template-haskell-quasiquoter and -lift --- System/OsPath/Common.hs | 22 ++++++++++++++++++---- System/OsPath/Internal.hs | 11 +++++++++-- filepath.cabal | 10 +++++++++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/System/OsPath/Common.hs b/System/OsPath/Common.hs index 5058b0e1..e8475ed6 100644 --- a/System/OsPath/Common.hs +++ b/System/OsPath/Common.hs @@ -124,20 +124,34 @@ import System.OsString.Windows as PS import Data.Bifunctor ( bimap ) import qualified System.OsPath.Windows.Internal as C import GHC.IO.Encoding.UTF16 ( mkUTF16le ) -import Language.Haskell.TH.Quote +#if __GLASGOW_HASKELL__ >= 914 +import Language.Haskell.TH.Lift + ( Lift(..), lift ) +import Language.Haskell.TH.QuasiQuoter ( QuasiQuoter (..) ) +#else import Language.Haskell.TH.Syntax - ( Lift (..), lift ) + ( Lift(..), lift ) +import Language.Haskell.TH.Quote + ( QuasiQuoter (..) ) +#endif import GHC.IO.Encoding.Failure ( CodingFailureMode(..) ) import Control.Monad ( when ) #elif defined(POSIX) import GHC.IO.Encoding.Failure ( CodingFailureMode(..) ) import Control.Monad ( when ) -import Language.Haskell.TH.Quote +#if __GLASGOW_HASKELL__ >= 914 +import Language.Haskell.TH.Lift + ( Lift(..), lift ) +import Language.Haskell.TH.QuasiQuoter ( QuasiQuoter (..) ) +#else import Language.Haskell.TH.Syntax - ( Lift (..), lift ) + ( Lift(..), lift ) +import Language.Haskell.TH.Quote + ( QuasiQuoter (..) ) +#endif import GHC.IO.Encoding.UTF8 ( mkUTF8 ) import System.OsPath.Types diff --git a/System/OsPath/Internal.hs b/System/OsPath/Internal.hs index bc1d5a9b..00498fb9 100644 --- a/System/OsPath/Internal.hs +++ b/System/OsPath/Internal.hs @@ -15,10 +15,17 @@ import Control.Monad.Catch ( MonadThrow ) import Data.ByteString ( ByteString ) -import Language.Haskell.TH.Quote +#if __GLASGOW_HASKELL__ >= 914 +import Language.Haskell.TH.Lift + ( Lift(..), lift ) +import Language.Haskell.TH.QuasiQuoter ( QuasiQuoter (..) ) +#else import Language.Haskell.TH.Syntax - ( Lift (..), lift ) + ( Lift(..), lift ) +import Language.Haskell.TH.Quote + ( QuasiQuoter (..) ) +#endif import GHC.IO.Encoding.Failure ( CodingFailureMode(..) ) import System.OsString.Internal.Types diff --git a/filepath.cabal b/filepath.cabal index 4c28480b..c2985d94 100644 --- a/filepath.cabal +++ b/filepath.cabal @@ -95,8 +95,16 @@ library , bytestring >=0.11.3.0 , deepseq , exceptions - , template-haskell , os-string >=2.0.1 + -- template-haskell-lift was added as a boot library in GHC-9.14 + -- once we no longer wish to backport releases to older major releases, + -- this conditional can be dropped + if impl(ghc < 9.14) + build-depends: template-haskell + elif impl(ghc) + build-depends: + , template-haskell-lift >=0.1 && <0.2 + , template-haskell-quasiquoter >=0.1 && <0.2 ghc-options: -Wall