diff options
author | simonmar <unknown> | 2005-03-24 16:14:11 +0000 |
---|---|---|
committer | simonmar <unknown> | 2005-03-24 16:14:11 +0000 |
commit | 19519dc35bad5649226a9f7015eaabb154722e54 (patch) | |
tree | ff882b1b62a7039917adda559313bd45bc16e938 /ghc/compiler/utils | |
parent | acc0fe48c73d06ac3b036da6c7e4fa073178018d (diff) | |
download | haskell-19519dc35bad5649226a9f7015eaabb154722e54.tar.gz |
[project @ 2005-03-24 16:14:00 by simonmar]
Cleanup the upsweep strategy in GHC.load.
Now it's hopefully clearer how we decide what modules to recompile,
and which are "stable" (not even looked at) during a reload. See the
comments for details.
Also, I've taken some trouble to explicitly prune out things that
aren't required before a reload, which should reduce the memory
requirements for :reload in GHCi. Currently I believe it keeps most
of the old program until the reload is complete, now it shouldn't
require any extra memory.
Diffstat (limited to 'ghc/compiler/utils')
-rw-r--r-- | ghc/compiler/utils/Util.lhs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/ghc/compiler/utils/Util.lhs b/ghc/compiler/utils/Util.lhs index d51a09d9ab..2f20226794 100644 --- a/ghc/compiler/utils/Util.lhs +++ b/ghc/compiler/utils/Util.lhs @@ -56,6 +56,7 @@ module Util ( -- IO-ish utilities createDirectoryHierarchy, doesDirNameExist, + modificationTimeIfExists, later, handleDyn, handle, @@ -89,10 +90,12 @@ import List ( zipWith4 ) #endif import Monad ( when ) -import IO ( catch ) +import IO ( catch, isDoesNotExistError ) import Directory ( doesDirectoryExist, createDirectory ) import Char ( isUpper, isAlphaNum, isSpace, ord, isDigit ) import Ratio ( (%) ) +import Time ( ClockTime ) +import Directory ( getModificationTime ) infixr 9 `thenCmp` \end{code} @@ -840,6 +843,16 @@ handle h f = f `Exception.catch` \e -> case e of #endif -- -------------------------------------------------------------- +-- check existence & modification time at the same time + +modificationTimeIfExists :: FilePath -> IO (Maybe ClockTime) +modificationTimeIfExists f = do + (do t <- getModificationTime f; return (Just t)) + `IO.catch` \e -> if isDoesNotExistError e + then return Nothing + else ioError e + +-- -------------------------------------------------------------- -- Filename manipulation type Suffix = String |