Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/e5182b7c8c7466a81de6d82d99e7d272b968691b

>---------------------------------------------------------------

commit e5182b7c8c7466a81de6d82d99e7d272b968691b
Author: Ian Lynagh <i...@well-typed.com>
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)



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to