diff options
author | Geoffrey Mainland <mainland@apeiron.net> | 2013-05-21 13:39:44 +0100 |
---|---|---|
committer | Geoffrey Mainland <mainland@apeiron.net> | 2013-10-04 14:58:26 -0400 |
commit | 4d226b32d86466d67fe857690136a1418897b672 (patch) | |
tree | 7ff2abfaded7d9f505ff39ddbe71f9bbcb3dae91 /libraries | |
parent | 29ea9438e97333af8053597ffd993c8676b0ed45 (diff) | |
download | haskell-4d226b32d86466d67fe857690136a1418897b672.tar.gz |
Add a method to the Quasi type class that adds new top-level declarations.
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/template-haskell/Language/Haskell/TH/Syntax.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs b/libraries/template-haskell/Language/Haskell/TH/Syntax.hs index 9c070102f2..899183eb37 100644 --- a/libraries/template-haskell/Language/Haskell/TH/Syntax.hs +++ b/libraries/template-haskell/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 ---------------------------------------------------- |