From c361a36e412319b547b704c51c377eeb02399c8d Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 4 Apr 2009 12:31:06 +0000 Subject: [PATCH] Added a message so that when we fail to find a file, we say exactly where we looked --- frontends/PreprocessOccam.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontends/PreprocessOccam.hs b/frontends/PreprocessOccam.hs index 7450328..2715934 100644 --- a/frontends/PreprocessOccam.hs +++ b/frontends/PreprocessOccam.hs @@ -50,15 +50,15 @@ searchFile m filename let currentFile = csCurrentFile cs let possibilities = joinPath currentFile filename : [dir ++ "/" ++ filename | dir <- csSearchPath cs] - openOneOf possibilities + openOneOf possibilities possibilities where - openOneOf :: [String] -> PassM (Handle, String) - openOneOf [] = dieP m $ "Unable to find " ++ filename - openOneOf (fn:fns) + openOneOf :: [String] -> [String] -> PassM (Handle, String) + openOneOf all [] = dieP m $ "Unable to find " ++ filename ++ " tried: " ++ show all + openOneOf all (fn:fns) = do r <- liftIO $ maybeIO $ openFile fn ReadMode case r of Just h -> return (h, fn) - Nothing -> openOneOf fns + Nothing -> openOneOf all fns -- | Preprocess a file and return its tokenised form ready for parsing. preprocessFile :: Meta -> String -> PassM [Token]