summaryrefslogtreecommitdiff
path: root/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-02-02 10:06:11 -0500
committerBen Gamari <ben@smart-cactus.org>2021-03-07 17:01:40 -0500
commit3e082f8ff5ea2f42c5e6430094683b26b5818fb8 (patch)
tree4c85427ff40740b654cf1911a20a3a478a9fb754 /libraries/template-haskell/Language/Haskell/TH/Syntax.hs
parentcf65cf16c89414273c4f6b2d090d4b2fffb90759 (diff)
downloadhaskell-wip/boxed-rep.tar.gz
Implement BoxedRep proposalwip/boxed-rep
This implements the BoxedRep proposal, refactoring the `RuntimeRep` hierarchy from: ```haskell data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ... ``` to ```haskell data RuntimeRep = BoxedRep Levity | ... data Levity = Lifted | Unlifted ``` Updates binary, haddock submodules. Closes #17526. Metric Increase: T12545
Diffstat (limited to 'libraries/template-haskell/Language/Haskell/TH/Syntax.hs')
-rw-r--r--libraries/template-haskell/Language/Haskell/TH/Syntax.hs8
1 files changed, 8 insertions, 0 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
index 6508c07a65..3cb5a44ee8 100644
--- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
+++ b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs
@@ -61,6 +61,10 @@ import Foreign.ForeignPtr
import Foreign.C.String
import Foreign.C.Types
+#if __GLASGOW_HASKELL__ >= 901
+import GHC.Types ( Levity(..) )
+#endif
+
-----------------------------------------------------
--
-- The Quasi class
@@ -816,7 +820,11 @@ class Lift (t :: TYPE r) where
-- | Turn a value into a Template Haskell expression, suitable for use in
-- a splice.
lift :: Quote m => t -> m Exp
+#if __GLASGOW_HASKELL__ >= 901
+ default lift :: (r ~ ('BoxedRep 'Lifted), Quote m) => t -> m Exp
+#else
default lift :: (r ~ 'LiftedRep, Quote m) => t -> m Exp
+#endif
lift = unTypeCode . liftTyped
-- | Turn a value into a Template Haskell typed expression, suitable for use