Repository : ssh://darcs.haskell.org//srv/darcs/packages/template-haskell On branch : th-new
http://hackage.haskell.org/trac/ghc/changeset/47ada06c121b0bcddae32fa5553b389668bebc8f >--------------------------------------------------------------- commit 47ada06c121b0bcddae32fa5553b389668bebc8f Author: Geoffrey Mainland <[email protected]> Date: Tue May 21 13:39:44 2013 +0100 Add a method to the Quasi type class that adds new top-level declarations. >--------------------------------------------------------------- Language/Haskell/TH/Syntax.hs | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Language/Haskell/TH/Syntax.hs b/Language/Haskell/TH/Syntax.hs index 6bb2787..c791ad5 100644 --- a/Language/Haskell/TH/Syntax.hs +++ b/Language/Haskell/TH/Syntax.hs @@ -68,6 +68,8 @@ class (Monad m, Applicative m) => Quasi m where qAddDependentFile :: FilePath -> m () + qAddTopDecls :: [Dec] -> m () + ----------------------------------------------------- -- The IO instance of Quasi -- @@ -93,6 +95,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 @@ -328,6 +331,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 @@ -338,6 +346,7 @@ instance Quasi Q where qLocation = location qRunIO = runIO qAddDependentFile = addDependentFile + qAddTopDecls = addTopDecls ---------------------------------------------------- _______________________________________________ ghc-commits mailing list [email protected] http://www.haskell.org/mailman/listinfo/ghc-commits
