[commit: packages/template-haskell] wip/th-new: Make a TExp a wrap a TH.Exp instead of a TH.ExpQ. (67d43c3)

git at git.haskell.org git at git.haskell.org
Mon Sep 23 07:59:22 CEST 2013


Repository : ssh://git@git.haskell.org/template-haskell

On branch  : wip/th-new
Link       : http://git.haskell.org/packages/template-haskell.git/commitdiff/67d43c32dc1c5a791f7a75a1c23c71df4af75ffc

>---------------------------------------------------------------

commit 67d43c32dc1c5a791f7a75a1c23c71df4af75ffc
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)


>---------------------------------------------------------------

67d43c32dc1c5a791f7a75a1c23c71df4af75ffc
 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 9d15f5f..41b379b 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