[keep initial loaded ho from libraries and generated ho separate. build libraries with just the generated part
John Meacham <john@repetae.net>**20060307030830] hunk ./FrontEnd/FrontEnd.hs 7
+import Data.Monoid
hunk ./FrontEnd/FrontEnd.hs 38
-               -> IO Ho     -- ^ the final combined ho.
+               -> IO (Ho,Ho)     -- ^ (the libraries and predifiend ho,the final combined ho of loaded code)
hunk ./FrontEnd/FrontEnd.hs 42
+    initialHo <- loadLibraries
+    initialHo <- ifunc initialHo
hunk ./FrontEnd/FrontEnd.hs 47
-            ho' <- findModule ho x ifunc (doModules func)
+            ho' <- findModule initialHo ho x ifunc (doModules func)
hunk ./FrontEnd/FrontEnd.hs 49
-    initialHo <- loadLibraries
-    ho <- f initialHo xs
+    ho <- f mempty  xs
hunk ./FrontEnd/FrontEnd.hs 51
-    when (dump FD.AllKind) $
-         do {putStrLn " ---- kind information ---- \n";
-             putStr $ PPrint.render $ pprint (hoKinds ho)}
-    --when  (dump FD.AllDcons) $
-    --    do {putStr " ---- data constructor assumptions ---- \n";
-    --         putStrLn $ PPrint.render $ pprintEnv (hoDConsAssumptions ho)}
-    return ho
+    return (initialHo,ho)
hunk ./Ho/Build.hs 106
-findModule :: Ho                                 -- ^ Accumulated Ho
+findModule :: Ho                                 -- ^ code loaded from libraries
+              -> Ho                              -- ^ Accumulated Ho
hunk ./Ho/Build.hs 109
-              -> (Ho -> IO Ho)                   -- ^ Process initial ho loaded from files and library
+              -> (Ho -> IO Ho)                   -- ^ Process initial ho loaded from file
hunk ./Ho/Build.hs 112
-findModule have (Left m) ifunc _ | m `Map.member` (hoExports have) = ifunc have
-findModule have need ifunc func  = do
+findModule lhave have (Left m) ifunc _
+    | m `Map.member` (hoExports have) = return have
+    | m `Map.member` (hoExports lhave) = return mempty -- libraries need no processing
+findModule lhave have need ifunc func  = do
hunk ./Ho/Build.hs 127
-            ho' <- func ho [ hs | (hs,_,_) <- sc ]
+            ho' <- func (lhave `mappend` ho) [ hs | (hs,_,_) <- sc ]
hunk ./Ho/Library.hs 65
-createLibrary :: FilePath
-              -> IO ()
-createLibrary fp = do
+createLibrary ::
+    FilePath
+    -> ([Module] -> IO Ho)
+    -> IO ()
+createLibrary fp wtd = do
hunk ./Ho/Library.hs 80
-    let noc _ hsm = fail ("createLibrary: won't compile anything, requested: "++show (map hsModuleName hsm))
hunk ./Ho/Library.hs 81
-    let fun ho m = do mho <- checkForHoModule m
-                      case mho of
-                        Nothing      -> fail (show fp ++ ": could not find module " ++ show m)
-                        Just (_,ho') -> return $ mappend ho ho'
-    ho <- foldM fun mempty allmods
-    let homods = sort $ Map.keys (hoExports ho)
-    when (homods /= allmods) $
-        putErrDie ("Final ho consists of wrong modules:\nexpected: \t"
-                   ++show allmods++"\nencountered: \t"++show homods)
-    let ho' = ho { hoExports = Map.difference (hoExports ho)
-                               (Map.fromList [(Module x,()) | x <- hmods]) }
+    ho <- wtd (map Module emods)
hunk ./Main.hs 94
-      BuildHl hl    -> createLibrary hl
+      BuildHl hl    -> createLibrary hl buildLibrary
hunk ./Main.hs 104
+buildLibrary [] = do
+    putStrLn "WARNING: building empty library"
+    return mempty
+buildLibrary mods = do
+    putVerboseLn $ "Building library containing: " ++ show mods
+    s <- Stats.new
+    (_,ho) <- parseFiles [] mods processInitialHo (processDecls s)
+    -- TODO optimize, leaving out hidden module exports
+    return ho
+
+
hunk ./Main.hs 381
-compileModEnv' stats ho = do
+compileModEnv' stats (initialHo,finalHo) = do
+    let ho = initialHo `mappend` finalHo
hunk ./Options.hs 37
-data Mode = BuildHl String -- ^ Load the specified hl-files (haskell libraries).
+data Mode = BuildHl String -- ^ Build the specified hl-file given a description file.
hunk ./Options.hs 71
+    optFollowDeps  :: !Bool,                   -- ^ Don't follow dependencies, all deps must be loaded from packages or specified on the command line.
hunk ./Options.hs 98
+    optFollowDeps  = True,
hunk ./Options.hs 139
+    , Option []    ["no-follow-deps"] (NoArg  (optFollowDeps_s False)) "Don't follow depencies not listed on command line."