[pass accumulated ho file throughout compilation process, reannotate accumulated ho with new rules as they occur.
John Meacham <john@repetae.net>**20060723055737] hunk ./FrontEnd/FrontEnd.hs 33
-               -> (Ho -> IO Ho) -- ^ Process initial data loaded from ho files
-               -> (Ho -> Ho -> Tc.TiData -> IO Ho)  -- ^ routine which takes the global ho, the partial local ho and the output of the front end, and returns the completed ho.
-               -> IO (Ho,Ho)     -- ^ (the libraries and predifiend ho,the final combined ho of loaded code)
+               -> (Ho -> Ho -> IO Ho) -- ^ Process initial data loaded from ho files
+               -> (Ho -> Ho -> Tc.TiData -> IO (Ho,Ho))  -- ^ routine which takes the global ho, the partial local ho and the output of the front end, and returns the completed ho.
+               -> IO (Ho,Ho)     -- ^ (the final combined ho,all the loaded ho data)
hunk ./FrontEnd/FrontEnd.hs 40
-    initialHo <- ifunc initialHo
+    initialHo <- ifunc mempty initialHo
hunk ./FrontEnd/FrontEnd.hs 42
-        f ho [] = return ho
-        f ho (x:xs) = do
-            ho' <- findModule initialHo ho x ifunc (doModules func)
-            f ho' xs
-    ho <- f mempty  xs
+        f accumHo ho [] = return (accumHo,ho)
+        f accumHo ho (x:xs) = do
+            (accumHo,ho') <- findModule accumHo x ifunc (doModules func)
+            f accumHo (ho `mappend` ho') xs
+    (initialHo,ho) <- f initialHo mempty  xs
hunk ./FrontEnd/FrontEnd.hs 51
-doModules :: (Ho -> Ho -> Tc.TiData -> IO Ho) -> Ho -> [HsModule] -> IO Ho
+doModules :: (Ho -> Ho -> Tc.TiData -> IO (Ho,Ho)) -> Ho -> [HsModule] -> IO (Ho,Ho)
hunk ./FrontEnd/FrontEnd.hs 60
-    ho'' <- func ho ho' tiData
-    return ho''
-    --me <- foldM tiModules emptyModEnv mss
+    func ho ho' tiData
hunk ./Ho/Build.hs 105
-findModule :: Ho                                 -- ^ code loaded from libraries
-              -> Ho                              -- ^ Accumulated Ho
+findModule :: Ho                              -- ^ Accumulated Ho
hunk ./Ho/Build.hs 107
-              -> (Ho -> IO Ho)                   -- ^ Process initial ho loaded from file
-              -> (Ho -> [HsModule] -> IO Ho)     -- ^ Process set of mutually recursive modules to produce final Ho
-              -> IO Ho                           -- ^ Final accumulated ho
-findModule lhave have (Left m) ifunc _
-    | m `mmember` (hoExports have) = return have
-    | m `mmember` (hoExports lhave) = return have
-findModule lhave have need ifunc func  = do
+              -> (Ho -> Ho -> IO Ho)             -- ^ Process initial ho loaded from file
+              -> (Ho -> [HsModule] -> IO (Ho,Ho))     -- ^ Process set of mutually recursive modules to produce final Ho
+              -> IO (Ho,Ho)                      -- ^ (Final accumulated ho,just the ho read to satisfy this command)
+findModule have (Left m) ifunc _
+    | m `mmember` (hoExports have) = return (have,mempty)
+findModule have need ifunc func  = do
hunk ./Ho/Build.hs 116
-    (ho,ms) <- getModule lhave have name files
+    (readHo,ms) <- getModule have name files
hunk ./Ho/Build.hs 122
-    let f ho [] = return ho
-        f ho (sc:scs) = do
-            ho' <- func (lhave `mappend` ho) [ hs | (hs,_,_) <- sc ]
+    let f ho readHo [] = return (ho,readHo)
+        f ho readHo (sc:scs) = do
+            (ho',newHo) <- func ho [ hs | (hs,_,_) <- sc ]
hunk ./Ho/Build.hs 128
-                ldeps = Map.fromList [ x | m <- mods', Right x <- Map.lookup m (hoModules lhave)]
+                ldeps = Map.fromList [ x | m <- mods', Right x <- Map.lookup m (hoModules have)]
hunk ./Ho/Build.hs 133
-            ho' <- return (ho' `mappend` mempty { hoLibraries = ldeps })
-            ho' <- recordHoFile ho' [ x | (_,_,x) <- sc ] hoh
-            f (ho `mappend` ho') scs
-    ho <- ifunc ho
-    f ho scc
+            newHo <- return (newHo `mappend` mempty { hoLibraries = ldeps })
+            newHo <- recordHoFile newHo [ x | (_,_,x) <- sc ] hoh
+            f ho' (readHo `mappend` newHo)  scs
+    ho <- ifunc have readHo
+    f ho readHo scc
hunk ./Ho/Build.hs 297
-    -> Ho       -- ^ Current set of modules, we assume anything in here is prefered to what is found on disk.
hunk ./Ho/Build.hs 300
-getModule initialHo ho name files  = do
-    ho_ref <- newIORef ho
-    fixup_ref <- newIORef (getFixups (initialHo `mappend` ho))
+getModule initialHo name files  = do
+    ho_ref <- newIORef mempty
hunk ./Ho/Build.hs 321
-                    r <- if hoLibraryDeps ho' (initialHo `mappend` ho) then f (hohModDepends hh) else return False
+                    r <- if hoLibraryDeps ho' initialHo then f (hohModDepends hh) else return False
hunk ./Ho/Build.hs 323
-                        True -> do
-                            fixups <- readIORef fixup_ref
-                            let nfixups = getFixups ho' `mappend` fixups
-                            writeIORef fixup_ref nfixups
-                            modifyIORef ho_ref (applyFixups nfixups ho' `mappend`) >> hClose fh
+                        True -> modifyIORef ho_ref (ho' `mappend`) >> hClose fh
hunk ./Main.hs 16
+import Atom
hunk ./Main.hs 185
-processInitialHo :: Ho -> IO Ho
-processInitialHo ho = do
-    let (ds,uids) = runWriter $ annotateDs mempty (collectIdAnn (hoRules ho) (hoProps ho) ) letann lamann (Map.elems $ hoEs ho)
+processInitialHo ::
+    Ho       -- ^ current accumulated ho
+    -> Ho    -- ^ new ho, freshly read from file
+    -> IO Ho -- ^ final combined ho data.
+processInitialHo accumho ho = do
+    let (ds,uids) = runWriter $ annotateDs imap (collectIdAnn (hoRules ho) (hoProps ho) ) letann lamann (Map.elems $ hoEs ho)
hunk ./Main.hs 192
-    return ho { hoUsedIds = uids, hoEs = Map.fromList [ (runIdentity $ fromId (tvrIdent v),d) |  d@(v,_) <- ds' ] }
+        imap = fromList [ (tvrIdent v,Just (EVar v))| (v,_) <- Map.elems (hoEs accumho)]
+        accumho' = reprocessHo (hoRules ho) (hoProps ho) accumho
+    return $ accumho' `mappend` ho { hoUsedIds = uids, hoEs = Map.fromList [ (runIdentity $ fromId (tvrIdent v),d) |  d@(v,_) <- ds' ] }
+
+reprocessHo :: Rules -> Map.Map Name [Atom] -> Ho -> Ho
+reprocessHo rules ps ho = ho { hoEs = Map.map f (hoEs ho) } where
+    f (t,e) = (tvrInfo_u (g (tvrIdent t)) t,e)
+    g id = runIdentity . idann rules ps id
+
hunk ./Main.hs 223
-    Stats.Stats   -- ^ statistics
-    -> Ho     -- ^ Collected ho
-    -> Ho     -- ^ preliminary haskell object  data
-    -> TiData -- ^ front end output
-    -> IO Ho  -- ^ final haskell object file
+    Stats.Stats    -- ^ statistics
+    -> Ho          -- ^ Collected ho
+    -> Ho          -- ^ preliminary haskell object  data
+    -> TiData      -- ^ front end output
+    -> IO (Ho,Ho)  -- ^ (new accumulated ho, final ho for this modules)
hunk ./Main.hs 287
-    let entryPoints = execWriter $ programMapDs_ (\ (t,_) -> when (getProperty prop_EXPORTED t) (tell [t])) prog
-    prog <- return $ prog { progEntryPoints = entryPoints }
hunk ./Main.hs 297
+    let entryPoints = execWriter $ programMapDs_ (\ (t,_) -> when (getProperty prop_EXPORTED t || member (tvrIdent t) rfreevars) (tell [t])) prog
+        rfreevars = ruleAllFreeVars rules
+    prog <- return $ prog { progEntryPoints = entryPoints }
+
hunk ./Main.hs 302
+    ho <- return $ reprocessHo rules (hoProps ho') ho
+
hunk ./Main.hs 525
-    return ho' { hoDataTable = dataTable, hoEs = programEsMap prog , hoRules = hoRules ho' `mappend` rules, hoUsedIds = collectIds (ELetRec (programDs prog) Unknown) }
+    let newHo = ho' {
+        hoDataTable = dataTable,
+        hoEs = programEsMap prog,
+        hoRules = hoRules ho' `mappend` rules,
+        hoUsedIds = collectIds (ELetRec (programDs prog) Unknown)
+        }
+    return (newHo `mappend` ho,newHo)
hunk ./Main.hs 565
-compileModEnv' stats (initialHo,finalHo) = do
-    let ho = initialHo `mappend` finalHo
-
+compileModEnv' stats (ho,_) = do
hunk ./Main.hs 1071
+