@@ -1218,13 +1218,18 @@ replSettings hFile = setComplete replCompletion $ defaultSettings {
1218 historyFile = hFile
1218 historyFile = hFile
1221−-- invoke as if from command line
1221+-- | Invoke as if from command line. It is an error if there are unresolved totality problems.
1222idris :: [Opt] -> IO (Maybe IState)
1222idris :: [Opt] -> IO (Maybe IState)
1223−idris opts = do res <- runErrorT $ execStateT (idrisMain opts) idrisInit
1223+idris opts = do res <- runErrorT $ execStateT totalMain idrisInit
1224 case res of
1224 case res of
1225 Left err -> do putStrLn $ pshow idrisInit err
1225 Left err -> do putStrLn $ pshow idrisInit err
1226 return Nothing
1226 return Nothing
1227 Right ist -> return (Just ist)
1227 Right ist -> return (Just ist)
1228+ where totalMain = do idrisMain opts
1230+ case idris_totcheckfail ist of
1231+ ((fc, msg):_) -> ierror . At fc . Msg $ "Could not build: "++ msg
1230loadInputs :: Handle -> [FilePath] -> Idris ()
1235loadInputs :: Handle -> [FilePath] -> Idris ()