summaryrefslogtreecommitdiff
path: root/libraries/template-haskell
diff options
context:
space:
mode:
authorAndrew Martin <andrew.thaddeus@gmail.com>2020-10-07 15:45:30 -0400
committerBen Gamari <ben@smart-cactus.org>2020-12-14 18:48:51 -0500
commit6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea (patch)
tree0a19d6cece0d63aadcfa6e014171a5baeaf4c167 /libraries/template-haskell
parentdad87210efffce9cfc2d17dc088a71d9dea14535 (diff)
downloadhaskell-6c2eb2232b39ff4720fda0a4a009fb6afbc9dcea.tar.gz
Implement BoxedRep proposal
This implements the BoxedRep proposal, refacoring the `RuntimeRep` hierarchy from: ```haskell data RuntimeRep = LiftedPtrRep | UnliftedPtrRep | ... ``` to ```haskell data RuntimeRep = BoxedRep Levity | ... data Levity = Lifted | Unlifted ``` Closes #17526.
Diffstat (limited to 'libraries/template-haskell')
-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 a3104ed684..c7d5c81c68 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