[project @ 2000-11-21 11:31:21 by simonmar]
authorsimonmar <unknown>
Tue, 21 Nov 2000 11:31:21 +0000 (11:31 +0000)
committersimonmar <unknown>
Tue, 21 Nov 2000 11:31:21 +0000 (11:31 +0000)
make ":l hello" load hello.hs if it exists.

ghc/compiler/compMan/CompManager.lhs

index ea850f9..abcdf6e 100644 (file)
@@ -552,12 +552,18 @@ downsweep rootNm
        getRootSummary :: FilePath -> IO ModSummary
        getRootSummary file
           | haskellish_file file
-           = do exists <- doesFileExist file
-               if exists then summariseFile file
-                         else getSummary (mkModuleName file)
-               -- ToDo: should check import paths
-          | otherwise
-          = getSummary (mkModuleName file)
+          = do exists <- doesFileExist file
+               if exists then summariseFile file else do
+               throwDyn (OtherError ("can't find file `" ++ file ++ "'"))      
+          | otherwise
+          = do exists <- doesFileExist hs_file
+               if exists then summariseFile hs_file else do
+               exists <- doesFileExist lhs_file
+               if exists then summariseFile lhs_file else do
+               getSummary (mkModuleName file)
+           where 
+                hs_file = file ++ ".hs"
+                lhs_file = file ++ ".lhs"
 
         getSummary :: ModuleName -> IO ModSummary
         getSummary nm
@@ -571,7 +577,7 @@ downsweep rootNm
                    -- These will then conflict with the passed-in versions.
                   Just (mod, location) -> summarise mod location
                   Nothing -> throwDyn (OtherError 
-                                   ("no signs of life for module `" 
+                                   ("can't find module `" 
                                      ++ showSDoc (ppr nm) ++ "'"))
                                  
         -- loop invariant: homeSummaries doesn't contain package modules