@@ -1,6 +1,7 @@
11module Idris.Imports where
22
33import Idris.AbsSyntax
4+import Idris.Error
45
56import Idris.Core.TT
67import Paths_idris
@@ -43,15 +44,15 @@ ibcPathWithFallback ibcsd fp = do let ibcp = ibcPath ibcsd True fp
4344ibcPathNoFallback :: FilePath -> FilePath -> FilePath
4445ibcPathNoFallback ibcsd fp = ibcPath ibcsd True fp
4546
46−findImport :: [FilePath] -> FilePath -> FilePath -> IO IFileType
47−findImport [] ibcsd fp = fail $ "Can't find import " ++ fp
47+findImport :: [FilePath] -> FilePath -> FilePath -> Idris IFileType
48+findImport [] ibcsd fp = ierror . Msg $ "Can't find import " ++ fp
4849findImport (d:ds) ibcsd fp = do let fp_full = d </> fp
49− ibcp <- ibcPathWithFallback ibcsd fp_full
50+ ibcp <- runIO $ ibcPathWithFallback ibcsd fp_full
5051 let idrp = srcPath fp_full
5152 let lidrp = lsrcPath fp_full
52− ibc <- doesFileExist ibcp
53− idr <- doesFileExist idrp
54− lidr <- doesFileExist lidrp
53+ ibc <- runIO $ doesFileExist ibcp
54+ idr <- runIO $ doesFileExist idrp
55+ lidr <- runIO $ doesFileExist lidrp
5556-- when idr $ putStrLn $ idrp ++ " ok"
5657-- when lidr $ putStrLn $ lidrp ++ " ok"
5758-- when ibc $ putStrLn $ ibcp ++ " ok"