[commit: packages/template-haskell] wip/th-new: Make a TExp a wrap a TH.Exp instead of a TH.ExpQ. (1d0dd7d)
git at git.haskell.org
git
Fri Oct 4 21:51:17 UTC 2013
Repository : ssh://git at git.haskell.org/template-haskell
On branch : wip/th-new
Link : http://git.haskell.org/packages/template-haskell.git/commitdiff/1d0dd7df7b3418956dc52017abec26083f8e998a
>---------------------------------------------------------------
commit 1d0dd7df7b3418956dc52017abec26083f8e998a
Author: Geoffrey Mainland <mainland at apeiron.net>
Date: Tue May 21 15:10:35 2013 +0100
Make a TExp a wrap a TH.Exp instead of a TH.ExpQ.
We also provide two new helper functions:
unTypeQ :: Q (TExp a) -> Q Exp
unsafeTExpCoerce :: Q Exp -> Q (TExp a)
>---------------------------------------------------------------
1d0dd7df7b3418956dc52017abec26083f8e998a
Language/Haskell/TH/Syntax.hs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Language/Haskell/TH/Syntax.hs b/Language/Haskell/TH/Syntax.hs
index 899183e..79e2944 100644
--- a/Language/Haskell/TH/Syntax.hs
+++ b/Language/Haskell/TH/Syntax.hs
@@ -145,7 +145,15 @@ instance Applicative Q where
--
-----------------------------------------------------
-newtype TExp a = TExp { unType :: Q Exp }
+newtype TExp a = TExp { unType :: Exp }
+
+unTypeQ :: Q (TExp a) -> Q Exp
+unTypeQ m = do { TExp e <- m
+ ; return e }
+
+unsafeTExpCoerce :: Q Exp -> Q (TExp a)
+unsafeTExpCoerce m = do { e <- m
+ ; return (TExp e) }
----------------------------------------------------
-- Packaged versions for the programmer, hiding the Quasi-ness
More information about the ghc-commits
mailing list