Repository : ssh://darcs.haskell.org//srv/darcs/packages/template-haskell On branch : master
http://hackage.haskell.org/trac/ghc/changeset/67850a7cb43303d7fb93177cae9298843fb99fe9 >--------------------------------------------------------------- commit 67850a7cb43303d7fb93177cae9298843fb99fe9 Author: Greg Weber <[email protected]> Date: Sun Oct 9 16:55:11 2011 -0700 addDependentFile #4900 Let GHC know about an external dependency that Template Haskell uses so that GHC can recompile when the dependency changes. No support for ghc -M >--------------------------------------------------------------- Language/Haskell/TH/Syntax.hs | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Language/Haskell/TH/Syntax.hs b/Language/Haskell/TH/Syntax.hs index 5c70fae..8533266 100644 --- a/Language/Haskell/TH/Syntax.hs +++ b/Language/Haskell/TH/Syntax.hs @@ -98,6 +98,7 @@ class (Monad m, Applicative m) => Quasi m where qRunIO :: IO a -> m a -- ^ Input/output (dangerous) + qAddDependentFile :: FilePath -> m () ----------------------------------------------------- -- The IO instance of Quasi @@ -123,6 +124,7 @@ instance Quasi IO where qReifyInstances _ _ = badIO "classInstances" qLocation = badIO "currentLocation" qRecover _ _ = badIO "recover" -- Maybe we could fix this? + qAddDependentFile _ = badIO "addDependentFile" qRunIO m = m @@ -209,15 +211,23 @@ location = Q qLocation runIO :: IO a -> Q a runIO m = Q (qRunIO m) +-- | Record external files that runIO is using (dependent upon). +-- The compiler can then recognize that it should re-compile the file using this TH when the external file changes. +-- Note that ghc -M will still not know about these dependencies - it does not execute TH. +-- Expects an absolute file path. +addDependentFile :: FilePath -> Q () +addDependentFile fp = Q (qAddDependentFile fp) + instance Quasi Q where - qNewName = newName - qReport = report - qRecover = recover - qReify = reify - qReifyInstances = reifyInstances - qLookupName = lookupName - qLocation = location - qRunIO = runIO + qNewName = newName + qReport = report + qRecover = recover + qReify = reify + qReifyInstances = reifyInstances + qLookupName = lookupName + qLocation = location + qRunIO = runIO + qAddDependentFile = addDependentFile ---------------------------------------------------- _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
