Skip to content
Snippets Groups Projects
Commit 2d7d9fde authored by Sebastian Graf's avatar Sebastian Graf
Browse files

Update packages that derive Lift for TH

This goes in tandem with ghc!12858.
parent ba786407
No related branches found
No related tags found
No related merge requests found
diff --git a/Data/DeriveLiftedInstances/Internal.hs b/Data/DeriveLiftedInstances/Internal.hs
index 7816a59..3429941 100644
--- a/Data/DeriveLiftedInstances/Internal.hs
+++ b/Data/DeriveLiftedInstances/Internal.hs
@@ -148,8 +148,10 @@ contains :: Data d => Name -> d -> Bool
contains nm = gmapQl (||) False (\d -> maybe (contains nm d) (== nm) $ cast d)
+#if !MIN_VERSION_template_haskell(2,22,1)
deriving instance Lift Fixity
deriving instance Lift FixityDirection
+#endif
-- | Helper for showing infix expressions
data ShowsPrec = ShowsPrec (Int -> String -> String) | ShowOp2 Fixity (Int -> String -> String) | ShowOp1 Fixity (Int -> String -> String)
diff --git a/src/Language/Haskell/TH/Lift.hs b/src/Language/Haskell/TH/Lift.hs
index 98d25b4..ef9efcc 100644
--- a/src/Language/Haskell/TH/Lift.hs
+++ b/src/Language/Haskell/TH/Lift.hs
@@ -264,30 +264,39 @@ typeDataError dataName = fail
$ ""
#endif
+#if !MIN_VERSION_template_haskell(2,22,1)
instance Lift Name where
lift (Name occName nameFlavour) = [| Name occName nameFlavour |]
#if MIN_VERSION_template_haskell(2,16,0)
liftTyped = unsafeSpliceCoerce . lift
#endif
+#endif
+#if !MIN_VERSION_template_haskell(2,22,1)
instance Lift OccName where
lift n = [| mkOccName |] `appE` lift (occString n)
#if MIN_VERSION_template_haskell(2,16,0)
liftTyped = unsafeSpliceCoerce . lift
#endif
+#endif
+#if !MIN_VERSION_template_haskell(2,22,1)
instance Lift PkgName where
lift n = [| mkPkgName |] `appE` lift (pkgString n)
#if MIN_VERSION_template_haskell(2,16,0)
liftTyped = unsafeSpliceCoerce . lift
#endif
+#endif
+#if !MIN_VERSION_template_haskell(2,22,1)
instance Lift ModName where
lift n = [| mkModName |] `appE` lift (modString n)
#if MIN_VERSION_template_haskell(2,16,0)
liftTyped = unsafeSpliceCoerce . lift
#endif
+#endif
+#if !MIN_VERSION_template_haskell(2,22,1)
instance Lift NameFlavour where
lift NameS = [| NameS |]
lift (NameQ modnam) = [| NameQ modnam |]
@@ -305,7 +314,9 @@ instance Lift NameFlavour where
#if MIN_VERSION_template_haskell(2,16,0)
liftTyped = unsafeSpliceCoerce . lift
#endif
+#endif
+#if !MIN_VERSION_template_haskell(2,22,1)
instance Lift NameSpace where
lift VarName = [| VarName |]
lift DataName = [| DataName |]
@@ -316,3 +327,4 @@ instance Lift NameSpace where
#if MIN_VERSION_template_haskell(2,16,0)
liftTyped = unsafeSpliceCoerce . lift
#endif
+#endif
diff --git a/src/Language/Haskell/TH/Instances.hs b/src/Language/Haskell/TH/Instances.hs
index 488fab5..27ee15c 100644
--- a/src/Language/Haskell/TH/Instances.hs
+++ b/src/Language/Haskell/TH/Instances.hs
@@ -121,7 +121,7 @@ import qualified Generics.Deriving.TH as Generic (deriveAll)
import qualified Control.Monad.Fail as Fail
#endif
-#if MIN_VERSION_template_haskell(2,16,0)
+#if MIN_VERSION_template_haskell(2,16,0) && !MIN_VERSION_template_haskell(2,22,1)
import GHC.Ptr (Ptr(Ptr))
import GHC.ForeignPtr (newForeignPtr_)
import Language.Haskell.TH.Syntax.Compat (liftTypedFromUntypedSplice)
@@ -435,7 +435,7 @@ deriving instance Typeable Ppr
deriving instance Typeable Quasi
#endif
-#if MIN_VERSION_template_haskell(2,16,0)
+#if MIN_VERSION_template_haskell(2,16,0) && !MIN_VERSION_template_haskell(2,22,1)
instance Lift Bytes where
lift bytes =
[| Bytes
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment