[commit: ghc] master: Add TH support for annotations (#8340) (627d1e0)

git at git.haskell.org git
Wed Oct 2 05:54:51 UTC 2013


Repository : ssh://git at git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/627d1e008cbe4d9318b2466394420a968d1659da/ghc

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

commit 627d1e008cbe4d9318b2466394420a968d1659da
Author: Austin Seipp <austin at well-typed.com>
Date:   Tue Oct 1 21:07:44 2013 -0500

    Add TH support for annotations (#8340)
    
    Authored-by: Gergely Risko <gergely at risko.hu>
    Signed-off-by: Austin Seipp <austin at well-typed.com>


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

627d1e008cbe4d9318b2466394420a968d1659da
 compiler/hsSyn/Convert.lhs |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs
index 616e05c..59cbc7b 100644
--- a/compiler/hsSyn/Convert.lhs
+++ b/compiler/hsSyn/Convert.lhs
@@ -480,6 +480,19 @@ cvtPragmaD (RuleP nm bndrs lhs rhs phases)
                                      rhs' placeHolderNames
        }
 
+cvtPragmaD (AnnP target exp)
+  = do { exp' <- cvtl exp
+       ; target' <- case target of
+         ModuleAnnotation  -> return ModuleAnnProvenance
+         TypeAnnotation n  -> do
+           n' <- tconName n
+           return (TypeAnnProvenance  n')
+         ValueAnnotation n -> do
+           n' <- if isVarName n then vName n else cName n
+           return (ValueAnnProvenance n')
+       ; returnL $ Hs.AnnD $ HsAnnotation target' exp'
+       }
+
 dfltActivation :: TH.Inline -> Activation
 dfltActivation TH.NoInline = NeverActive
 dfltActivation _           = AlwaysActive




More information about the ghc-commits mailing list