Repository : ssh://g...@git.haskell.org/template-haskell On branch : wip/th-new Link : http://git.haskell.org/packages/template-haskell.git/commitdiff/2adfa015e1e926f157e979b7cbd34717f3fe3c3a
>--------------------------------------------------------------- commit 2adfa015e1e926f157e979b7cbd34717f3fe3c3a Author: Geoffrey Mainland <mainl...@apeiron.net> Date: Tue May 21 13:39:44 2013 +0100 Add a method to the Quasi type class that adds new top-level declarations. >--------------------------------------------------------------- 2adfa015e1e926f157e979b7cbd34717f3fe3c3a Language/Haskell/TH/Syntax.hs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Language/Haskell/TH/Syntax.hs b/Language/Haskell/TH/Syntax.hs index 9c07010..899183e 100644 --- a/Language/Haskell/TH/Syntax.hs +++ b/Language/Haskell/TH/Syntax.hs @@ -62,6 +62,8 @@ class (Monad m, Applicative m) => Quasi m where qAddDependentFile :: FilePath -> m () + qAddTopDecls :: [Dec] -> m () + ----------------------------------------------------- -- The IO instance of Quasi -- @@ -88,6 +90,7 @@ instance Quasi IO where qLocation = badIO "currentLocation" qRecover _ _ = badIO "recover" -- Maybe we could fix this? qAddDependentFile _ = badIO "addDependentFile" + qAddTopDecls _ = badIO "addTopDecls" qRunIO m = m @@ -330,6 +333,11 @@ runIO m = Q (qRunIO m) addDependentFile :: FilePath -> Q () addDependentFile fp = Q (qAddDependentFile fp) +-- | Add additional top-level declarations. The added declarations will be type +-- checked along with the current declaration group. +addTopDecls :: [Dec] -> Q () +addTopDecls ds = Q (qAddTopDecls ds) + instance Quasi Q where qNewName = newName qReport = report @@ -341,6 +349,7 @@ instance Quasi Q where qLocation = location qRunIO = runIO qAddDependentFile = addDependentFile + qAddTopDecls = addTopDecls ---------------------------------------------------- _______________________________________________ ghc-commits mailing list ghc-commits@haskell.org http://www.haskell.org/mailman/listinfo/ghc-commits