@@ -19,6 +19,7 @@ import IRTS.Inliner
1919
2020import Idris.AbsSyntax
2121import Idris.UnusedArgs
22+import Idris.Error
2223
2324import Core.TT
2425import Core.Evaluate
@@ -91,11 +92,11 @@ compile codegen f tm
9192 ViaLLVM -> codegenLLVM c triple cpu optimize f outty
9293
9394 Bytecode -> dumpBC c f
94− Error e -> fail $ show e
95+ Error e -> ierror e
9596 where checkMVs = do i <- getIState
9697 case idris_metavars i \\ primDefs of
9798 [] -> return ()
98− ms -> fail $ "There are undefined metavariables: " ++ show ms
99+ ms -> ifail $ "There are undefined metavariables: " ++ show ms
99100 inDir d h = do let f = d </> h
100101 ex <- doesFileExist f
101102 if ex then return f else return h
@@ -249,7 +250,7 @@ instance ToIR (TT Name) where
249250-- = return $ LConst (BI 0)
250251 ir' env (P _ n _) = return $ LV (Glob n)
251252 ir' env (V i) | i >= 0 && i < length env = return $ LV (Glob (env!!i))
252− | otherwise = error $ "IR fail " ++ show i ++ " " ++ show tm
253+ | otherwise = ifail $ "IR fail " ++ show i ++ " " ++ show tm
253254 ir' env (Bind n (Lam _) sc)
254255 = do let n' = uniqueName n env
255256 sc' <- ir' (n' : env) sc
@@ -286,14 +287,14 @@ instance ToIR (TT Name) where
286287 = let maybeTys = getFTypes fgnArgTys
287288 rty = mkIty' ret in
288289 case maybeTys of
289− Nothing -> fail $ "Foreign type specification is not a constant list: " ++ show (fgn:args)
290+ Nothing -> ifail $ "Foreign type specification is not a constant list: " ++ show (fgn:args)
290291 Just tys -> do
291292 args' <- mapM (ir' env) (init args)
292293 -- wrap it in a prim__IO
293294 -- return $ con_ 0 @@ impossible @@
294295 return $ -- LLazyExp $
295296 LForeign LANG_C rty fgnName (zip tys args')
296− | otherwise = fail "Badly formed foreign function call"
297+ | otherwise = ifail "Badly formed foreign function call"
297298
298299getFTypes :: TT Name -> Maybe [FType]
299300getFTypes tm = case unApply tm of
@@ -386,7 +387,7 @@ instance ToIR SC where
386387 LConst (BI 1)]) rhs')
387388-- return $ LSucCase n rhs'
388389 mkIRAlt _ (ConstCase c rhs)
389− = fail $ "Can't match on (" ++ show c ++ ")"
390+ = ifail $ "Can't match on (" ++ show c ++ ")"
390391 mkIRAlt _ (DefaultCase rhs)
391392 = do rhs' <- ir rhs
392393 return $ LDefaultCase rhs'