@@ -19,6 +19,7 @@ import IRTS.Inliner
20import Idris.AbsSyntax
20import Idris.AbsSyntax
21import Idris.UnusedArgs
21import Idris.UnusedArgs
23import Core.TT
24import Core.TT
24import Core.Evaluate
25import Core.Evaluate
@@ -91,11 +92,11 @@ compile codegen f tm
91 ViaLLVM -> codegenLLVM c triple cpu optimize f outty
92 ViaLLVM -> codegenLLVM c triple cpu optimize f outty
93 Bytecode -> dumpBC c f
94 Bytecode -> dumpBC c f
94− Error e -> fail $ show e
95+ Error e -> ierror e
95 where checkMVs = do i <- getIState
96 where checkMVs = do i <- getIState
96 case idris_metavars i \\ primDefs of
97 case idris_metavars i \\ primDefs of
97 [] -> return ()
98 [] -> return ()
98− ms -> fail $ "There are undefined metavariables: " ++ show ms
99+ ms -> ifail $ "There are undefined metavariables: " ++ show ms
99 inDir d h = do let f = d </> h
100 inDir d h = do let f = d </> h
100 ex <- doesFileExist f
101 ex <- doesFileExist f
101 if ex then return f else return h
102 if ex then return f else return h
@@ -249,7 +250,7 @@ instance ToIR (TT Name) where
249-- = return $ LConst (BI 0)
250-- = return $ LConst (BI 0)
250 ir' env (P _ n _) = return $ LV (Glob n)
251 ir' env (P _ n _) = return $ LV (Glob n)
251 ir' env (V i) | i >= 0 && i < length env = return $ LV (Glob (env!!i))
252 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
253 ir' env (Bind n (Lam _) sc)
254 ir' env (Bind n (Lam _) sc)
254 = do let n' = uniqueName n env
255 = do let n' = uniqueName n env
255 sc' <- ir' (n' : env) sc
256 sc' <- ir' (n' : env) sc
@@ -286,14 +287,14 @@ instance ToIR (TT Name) where
286 = let maybeTys = getFTypes fgnArgTys
287 = let maybeTys = getFTypes fgnArgTys
287 rty = mkIty' ret in
288 rty = mkIty' ret in
288 case maybeTys of
289 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)
290 Just tys -> do
291 Just tys -> do
291 args' <- mapM (ir' env) (init args)
292 args' <- mapM (ir' env) (init args)
292 -- wrap it in a prim__IO
293 -- wrap it in a prim__IO
293 -- return $ con_ 0 @@ impossible @@
294 -- return $ con_ 0 @@ impossible @@
294 return $ -- LLazyExp $
295 return $ -- LLazyExp $
295 LForeign LANG_C rty fgnName (zip tys args')
296 LForeign LANG_C rty fgnName (zip tys args')
296− | otherwise = fail "Badly formed foreign function call"
297+ | otherwise = ifail "Badly formed foreign function call"
298getFTypes :: TT Name -> Maybe [FType]
299getFTypes :: TT Name -> Maybe [FType]
299getFTypes tm = case unApply tm of
300getFTypes tm = case unApply tm of
@@ -386,7 +387,7 @@ instance ToIR SC where
386 LConst (BI 1)]) rhs')
387 LConst (BI 1)]) rhs')
387-- return $ LSucCase n rhs'
388-- return $ LSucCase n rhs'
388 mkIRAlt _ (ConstCase c rhs)
389 mkIRAlt _ (ConstCase c rhs)
389− = fail $ "Can't match on (" ++ show c ++ ")"
390+ = ifail $ "Can't match on (" ++ show c ++ ")"
390 mkIRAlt _ (DefaultCase rhs)
391 mkIRAlt _ (DefaultCase rhs)
391 = do rhs' <- ir rhs
392 = do rhs' <- ir rhs
392 return $ LDefaultCase rhs'
393 return $ LDefaultCase rhs'