diff --git a/Data/Text.hs b/Data/Text.hs index dd1b821ce754610285ff30d6958d229cef85c368..8b32b02c5370da56e1489317152c7a4c87b66862 100644 --- a/Data/Text.hs +++ b/Data/Text.hs @@ -254,7 +254,7 @@ import GHC.Base (eqInt, neInt, gtInt, geInt, ltInt, leInt) import qualified GHC.Exts as Exts #endif import qualified Language.Haskell.TH.Lib as TH -import Language.Haskell.TH.Syntax (Lift, lift) +import qualified Language.Haskell.TH.Syntax as TH #if MIN_VERSION_base(4,7,0) import Text.Printf (PrintfArg, formatArg, formatString) #endif @@ -428,8 +428,11 @@ instance Data Text where -- it preserves abstraction at the cost of inefficiency. -- -- @since 1.2.4.0 -instance Lift Text where +instance TH.Lift Text where lift = TH.appE (TH.varE 'pack) . TH.stringE . unpack +#if MIN_VERSION_template_haskell(2,16,0) + liftTyped = TH.unsafeTExpCoerce . TH.lift +#endif #if MIN_VERSION_base(4,7,0) -- | Only defined for @base-4.7.0.0@ and later diff --git a/Data/Text/Lazy.hs b/Data/Text/Lazy.hs index 8246baf1ee4cea773b5c6d918cedc5c84f349d14..be893c4cd960ffcb9b87e51984de184e754c1b8c 100644 --- a/Data/Text/Lazy.hs +++ b/Data/Text/Lazy.hs @@ -248,7 +248,7 @@ import qualified GHC.Exts as Exts #endif import GHC.Prim (Addr#) import qualified Language.Haskell.TH.Lib as TH -import Language.Haskell.TH.Syntax (Lift, lift) +import qualified Language.Haskell.TH.Syntax as TH #if MIN_VERSION_base(4,7,0) import Text.Printf (PrintfArg, formatArg, formatString) #endif @@ -413,8 +413,11 @@ instance Data Text where -- it preserves abstraction at the cost of inefficiency. -- -- @since 1.2.4.0 -instance Lift Text where +instance TH.Lift Text where lift = TH.appE (TH.varE 'pack) . TH.stringE . unpack +#if MIN_VERSION_template_haskell(2,16,0) + liftTyped = TH.unsafeTExpCoerce . TH.lift +#endif #if MIN_VERSION_base(4,7,0) -- | Only defined for @base-4.7.0.0@ and later