[commit: ghc] master: Add replaceDynFlags to the ContainsDynFlags class (e5182b7)
Ian Lynagh <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cvs.ghc |
|---|---|
| Message-ID | <[email protected]> |
Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master http://hackage.haskell.org/trac/ghc/changeset/e5182b7c8c7466a81de6d82d99e7d272b968691b >--------------------------------------------------------------- commit e5182b7c8c7466a81de6d82d99e7d272b968691b Author: Ian Lynagh <[email protected]> Date: Sat Dec 8 17:16:07 2012 +0000 Add replaceDynFlags to the ContainsDynFlags class >--------------------------------------------------------------- compiler/main/DynFlags.hs | 1 + compiler/main/HscTypes.lhs | 4 ++++ compiler/typecheck/TcRnTypes.lhs | 2 ++ 3 files changed, 7 insertions(+), 0 deletions(-) diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index ceae7c2..9d2b372 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -707,6 +707,7 @@ class HasDynFlags m where class ContainsDynFlags t where extractDynFlags :: t -> DynFlags + replaceDynFlags :: t -> DynFlags -> t data ProfAuto = NoProfAuto -- ^ no SCC annotations added diff --git a/compiler/main/HscTypes.lhs b/compiler/main/HscTypes.lhs index 937d09a..fce81da 100644 --- a/compiler/main/HscTypes.lhs +++ b/compiler/main/HscTypes.lhs @@ -326,6 +326,10 @@ data HscEnv -- 'TcRunTypes.TcGblEnv' } +instance ContainsDynFlags HscEnv where + extractDynFlags env = hsc_dflags env + replaceDynFlags env dflags = env {hsc_dflags = dflags} + -- | Retrieve the ExternalPackageState cache. hscEPS :: HscEnv -> IO ExternalPackageState hscEPS hsc_env = readIORef (hsc_EPS hsc_env) diff --git a/compiler/typecheck/TcRnTypes.lhs b/compiler/typecheck/TcRnTypes.lhs index 0aff832..8388b25 100644 --- a/compiler/typecheck/TcRnTypes.lhs +++ b/compiler/typecheck/TcRnTypes.lhs @@ -181,6 +181,8 @@ data Env gbl lcl instance ContainsDynFlags (Env gbl lcl) where extractDynFlags env = hsc_dflags (env_top env) + replaceDynFlags env dflags + = env {env_top = replaceDynFlags (env_top env) dflags} instance ContainsModule gbl => ContainsModule (Env gbl lcl) where extractModule env = extractModule (env_gbl env)