[project @ 2002-11-11 10:59:07 by simonpj]
authorsimonpj <unknown>
Mon, 11 Nov 2002 10:59:09 +0000 (10:59 +0000)
committersimonpj <unknown>
Mon, 11 Nov 2002 10:59:09 +0000 (10:59 +0000)
Comments only

ghc/compiler/typecheck/TcSplice.lhs
ghc/compiler/typecheck/TcTyClsDecls.lhs

index 18f6996..2ae265c 100644 (file)
@@ -33,6 +33,7 @@ import TcRnMonad
 
 import TysWiredIn      ( mkListTy )
 import DsMeta          ( exprTyConName, declTyConName, decTyConName, qTyConName )
+import CmdLineOpts     ( DynFlags(..), CoreToDo(..), SimplifierMode(..), SimplifierSwitch(..) )
 import Outputable
 import GHC.Base                ( unsafeCoerce# )       -- Should have a better home in the module hierarchy
 \end{code}
@@ -224,21 +225,21 @@ runMeta expr
     getGlobalRdrEnv    `thenM` \ rdr_env -> 
     let
        ghci_mode = top_mode top_env
+       dflags    = top_dflags top_env
 
-       hsc_env = HscEnv { hsc_mode = ghci_mode, hsc_HPT = top_hpt top_env,
-                          hsc_dflags = top_dflags top_env }
+       -- Compile the Template Haskell stuff with low 
+       -- optimisation even if the main compilation has
+       -- high optimisation.  This is a bit of a hack.
+       th_dflags = dflags { coreToDo = thCoreToDo }
+
+       hsc_env = HscEnv { hsc_mode   = ghci_mode, 
+                          hsc_HPT    = top_hpt top_env,
+                          hsc_dflags = th_dflags }
 
        pcs = PCS { pcs_nc = name_cache, pcs_EPS = eps }
 
        print_unqual = unQualInScope rdr_env
     in
-    if (ghci_mode == OneShot) then
-       failWithTc (ptext SLIT("You must use --make or --interactive to run splice expressions"))
-       -- The reason for this is that the demand-linker doesn't have
-       -- enough information available to link all the things that
-       -- are needed when you try to run a splice
-    else
-
     ioToTcRn (HscMain.compileExpr hsc_env pcs this_mod 
                                  print_unqual expr) `thenM` \ hval ->
 
@@ -249,6 +250,10 @@ runMeta expr
                                        nest 4 (vcat [text "Code:" <+> ppr expr,
                                                      text ("Exn: " ++ show exn)])])
          Right v  -> returnM v
+
+
+thCoreToDo :: [CoreToDo]
+thCoreToDo = [] -- CoreDoSimplify (SimplPhase 0) [MaxSimplifierIterations 3]]
 \end{code}
 
 
index 404d4cb..0da4daf 100644 (file)
@@ -403,6 +403,8 @@ mkNewTyConRep :: TyCon              -- The original type constructor
                                -- (guaranteed not to be another newtype)
 
 -- Find the representation type for this newtype TyCon
+-- Remember that the representation type is the ultimate representation
+-- type, looking through other newtypes.
 -- 
 -- The non-recursive newtypes are easy, because they look transparent
 -- to splitTyConApp_maybe, but recursive ones really are represented as