[don't search for modules that are already present in one of the loaded libraries
John Meacham <john@repetae.net>**20060307041656] hunk ./Ho/Build.hs 114
-    | m `Map.member` (hoExports lhave) = return mempty -- libraries need no processing
+    | m `Map.member` (hoExports lhave) = return mempty
hunk ./Ho/Build.hs 119
-    (ho,ms) <- getModule have name files
+    (ho,ms) <- getModule lhave have name files
hunk ./Ho/Build.hs 130
-                mdeps = [ (m,runIdentity $ Map.lookup m (hoModules ho)) | m <- mods']
+                mdeps = [ (m,dep) | m <- mods', Left dep <- Map.lookup m (hoModules ho)]
+                ldeps = Map.unions [ Map.singleton ln cs | m <- mods', Right (ln,cs) <- Map.lookup m (hoModules ho)]
hunk ./Ho/Build.hs 138
-            f (ho `mappend` ho') scs
-    ho <- ifunc (ho `mappend` have)
+            f (ho `mappend` ho' `mappend` mempty { hoLibraries = ldeps }) scs
+    ho <- ifunc ho
hunk ./Ho/Build.hs 152
-    -- (fh,dep) <- openGetFileDep fn
---    if optIgnoreHo options then do
---        wdump FD.Progress $ do
---            fn' <- shortenPath fn
---            putErrLn $ "Skipping haskell object file:" <+> fn'
---        return Nothing
---     else do
-    --wdump FD.Progress $ do
-    --    putErrLn $ "Found haskell object file:" <+> fn
hunk ./Ho/Build.hs 164
-        return $ Just (hh,ho { hoModules = fmap (const dep) (hoExports ho) })
+        return $ Just (hh,ho { hoModules = fmap (const (Left dep)) (hoExports ho) })
hunk ./Ho/Build.hs 236
-    -> IO Ho         -- ^ Ho updated with this recordfiel dependencies
+    -> IO Ho         -- ^ Ho updated with this recordfile dependencies
hunk ./Ho/Build.hs 242
-        return (ho { hoModules = fmap (const emptyFileDep) (hoExports ho) })
+        return (ho { hoModules = fmap (const $ Left emptyFileDep) (hoExports ho) })
hunk ./Ho/Build.hs 281
-    return (ho { hoModules = fmap (const dep) (hoExports ho) })
+    return (ho { hoModules = fmap (const $ Left dep) (hoExports ho) })
hunk ./Ho/Build.hs 293
-    Ho          -- ^ Current set of modules, we assume anything in here is prefered to what is found on disk.
+    Ho          -- ^ initialHo
+    -> Ho       -- ^ Current set of modules, we assume anything in here is prefered to what is found on disk.
hunk ./Ho/Build.hs 298
-getModule ho name files  = do
+getModule initialHo ho name files  = do
+    putVerboseLn $ "getModule: " ++ show name ++ show files
hunk ./Ho/Build.hs 301
-    fixup_ref <- newIORef (getFixups ho)
+    fixup_ref <- newIORef (getFixups (initialHo `mappend` ho))
hunk ./Ho/Build.hs 335
-            case Map.lookup m (hoModules ho) of
-                Just fd' | fd == fd' -> return True
-                Just fd' | fd /= emptyFileDep -> do
+            case Map.lookup m (hoModules (initialHo `mappend` ho)) of
+                Just (Left fd') | fd == fd' -> return True
+                Just (Left fd') | fd /= emptyFileDep -> do
hunk ./Ho/Build.hs 341
-                Just _ -> return False
+                Just (Left _) -> return False
+                Just (Right (cl,_)) -> putVerboseLn  (show m ++ " found in " ++ show cl) >> return True
hunk ./Ho/Build.hs 380
-                      -- warnF fn "parse-error" err >> return emptyHsModule
hunk ./Ho/Build.hs 404
-{-
-emptyHsModule = HsModule {
-    hsModuleName = Module "@invalid",
-    hsModuleImports = [],
-    hsModuleExports = Nothing,
-    hsModuleDecls = [],
-    hsModuleOptions = []
-    }
--}
hunk ./Ho/Build.hs 452
-{-
-    let ds = Map.elems $ hoEs initialHo
-    cds <- E.Strictness.solveDs ds
-    cds <- return $ fst (E.CPR.cprAnalyzeBinds mempty cds)
-    mapM_ (\t -> putStrLn (prettyE (EVar t) <+> show (tvrInfo t))) (fsts cds)
-    return initialHo { hoEs = Map.fromList [ (n,v) | v <- cds | n <- Map.keys (hoEs initialHo) ] }
-    -}
-
-
-
-
-
-    {-
-    f n t p d = ans where
-        (r':as') = reverse t
-        r = tt r'
-        as = map tt (reverse as')
-        tt 'a' = ELit (LitCons (parseName TypeConstructor d) [] eStar)
-        tt 'B' = tBool
-        tt 'I' = tInt
-        tvs = [  (TVr i a) | a <- as | i <- [ 2,4 ..]]
-        ans = foldr ELam (EPrim (primPrim p) (map EVar tvs) r) tvs
-      -}
-
-
-
-
-    {-
-
-    -- Collect all complete 'ho' files and parsed code we need to compile
---getModule :: Set.Set String -> String -> [(String,String)] -> IO (Ho,[],[FileDep])
-getModule ws name files = do
-    --wdump FD.Progress $ do
-    --    putErrLn $ "getModule:" <+> tshow ws <+> tshow name <+> tshow files
-    (c,fd,honm) <- findFirstFile name files
-    if fd == emptyFileDep then return (mempty,mempty,mempty) else do
-    ho <- checkForHoFile honm
-    case ho of
-        Just (ds,ho) -> mapM_ (\x -> modifyIORef ws (Set.insert x)) (Map.keys $ hoExports ho) >> return (ho,mempty,ds)
-        Nothing -> do
-            hs <- parseHsSource (fromAtom $ fileName fd) c
-            wdump FD.Progress $ do
-                putErrLn $ "Found dependency:" <+> name <+> "at" <+> fromAtom (fileName fd)  <+> show (hsModuleRequires hs)
-            --print hs
-            modifyIORef ws $ Set.insert ( hsModuleName hs)
-            ws' <- readIORef ws
-            --mapM_ (modifyIORef ws) [Set.insert (Module x) | x <- hsModuleRequires hs]
-            let f x = do
-                ws' <- readIORef ws
-                case Module x `Set.member` ws' of
-                    True ->  return (mempty,mempty,mempty)
-                    False -> Ho.getModule ws x (searchPaths x)
-                --f x | Module x `Set.member` ws' = return (mempty,mempty,mempty)
-                --    | otherwise = Ho.getModule ws x (searchPaths x)
-            xs <- mapM f (hsModuleRequires hs)
-            let x@(_,_,ds) = mconcat xs
-            return $ mconcat [(mempty,[(hs,fd,honm,ds)],mempty),x]
-
-            -}
hunk ./Ho/Library.hs 45
-        pkg <- readLibraryFile rfp mbcs
+        pkg <- readLibraryFile name rfp mbcs
hunk ./Ho/Library.hs 125
-readLibraryFile :: FilePath -> Maybe CheckSum -> IO Library
-readLibraryFile fp mbcs = do
+readLibraryFile :: LibraryName -> FilePath -> Maybe CheckSum -> IO Library
+readLibraryFile lname fp mbcs = do
hunk ./Ho/Library.hs 137
-                    libraryHo  = ho
+                    libraryHo  = ho { hoModules = Map.map (const $ Right (lname,pkgCS)) $ hoModules ho }
hunk ./Ho/Type.hs 44
-    hoModules :: Map.Map Module FileDep,     -- ^ Map of module to ho file, This never actually ends up in the binary file on disk, but is filled in when the file is read.
+    hoModules :: Map.Map Module (Either FileDep (LibraryName,CheckSum)),     -- ^ Map of module to ho file, This never actually ends up in the binary file on disk, but is filled in when the file is read, libraries have no non-library dependencies.