From 1a61eca6bd3468ecbfc67c6670765ecf2b454489 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 21 Nov 2000 11:31:21 +0000 Subject: [PATCH] [project @ 2000-11-21 11:31:21 by simonmar] make ":l hello" load hello.hs if it exists. --- ghc/compiler/compMan/CompManager.lhs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/ghc/compiler/compMan/CompManager.lhs b/ghc/compiler/compMan/CompManager.lhs index ea850f9..abcdf6e 100644 --- a/ghc/compiler/compMan/CompManager.lhs +++ b/ghc/compiler/compMan/CompManager.lhs @@ -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 -- 1.7.10.4