Fixed a bug in 'hasChanged'.
This commit is contained in:
parent
ecef36e749
commit
36fa0c6433
@ -372,16 +372,18 @@ hasChanged = hasChanged' ["hs","lhs"]
|
|||||||
|
|
||||||
hasChanged' :: [String] -> Module -> IO Bool
|
hasChanged' :: [String] -> Module -> IO Bool
|
||||||
hasChanged' suffices m@(Module {path = p})
|
hasChanged' suffices m@(Module {path = p})
|
||||||
= do mbFile <- findFile suffices p
|
= do modFile <- doesFileExist p
|
||||||
|
mbFile <- findFile suffices p
|
||||||
case mbFile of
|
case mbFile of
|
||||||
Nothing -> return False
|
Just f | modFile
|
||||||
Just f -> do srcT <- getModificationTime f
|
-> do srcT <- getModificationTime f
|
||||||
objT <- getModificationTime p
|
objT <- getModificationTime p
|
||||||
if srcT > objT
|
if srcT > objT
|
||||||
then return True
|
then return True
|
||||||
else do deps <- getModuleDeps m
|
else do deps <- getModuleDeps m
|
||||||
depsStatus <- mapM (hasChanged' suffices) deps
|
depsStatus <- mapM (hasChanged' suffices) deps
|
||||||
return (or depsStatus)
|
return (or depsStatus)
|
||||||
|
_ -> return False
|
||||||
where findFile :: [String] -> FilePath -> IO (Maybe FilePath)
|
where findFile :: [String] -> FilePath -> IO (Maybe FilePath)
|
||||||
findFile [] _ = return Nothing
|
findFile [] _ = return Nothing
|
||||||
findFile (ext:exts) file
|
findFile (ext:exts) file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user