[commit: template-haskell] th-new-7.6: Make a TExp a wrap a TH.Exp instead of a TH.ExpQ. (c0a41ed)

Geoffrey Mainland gmainlan at microsoft.com
Wed Jun 12 12:04:18 CEST 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/template-haskell

On branch  : th-new-7.6

http://hackage.haskell.org/trac/ghc/changeset/c0a41edbd81dd2cf2a128f494ede74c7636d16e3

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

commit c0a41edbd81dd2cf2a128f494ede74c7636d16e3
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)

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

 Language/Haskell/TH/Syntax.hs |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/Language/Haskell/TH/Syntax.hs b/Language/Haskell/TH/Syntax.hs
index 4a0aeae..acca18d 100644
--- a/Language/Haskell/TH/Syntax.hs
+++ b/Language/Haskell/TH/Syntax.hs
@@ -150,7 +150,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