@@ -31,6 +31,7 @@ import Idris.REPL.Parser
31import IRTS.CodegenCommon
31import IRTS.CodegenCommon
33import Util.System
33import Util.System
34+import qualified Util.Pretty
35import Control.Category
36import Control.Category
36import Control.DeepSeq
37import Control.DeepSeq
@@ -195,7 +196,7 @@ idrisMain opts =
195 mapM_ (\str -> do ist <- getIState
196 mapM_ (\str -> do ist <- getIState
196 c <- colourise
197 c <- colourise
197 case parseExpr ist str of
198 case parseExpr ist str of
198− Left err -> do iputStrLn . show . fixColour c . parseErrorDoc $ err
199+ Left err -> do iWarn (errorExtent err) (Util.Pretty.text $ errorMessage err)
199 runIO $ exitWith (ExitFailure 1)
200 runIO $ exitWith (ExitFailure 1)
200 Right e -> process "" (Eval e))
201 Right e -> process "" (Eval e))
@@ -272,7 +273,7 @@ execScript :: String -> Idris ()
272execScript expr = do i <- getIState
273execScript expr = do i <- getIState
273 c <- colourise
274 c <- colourise
274 case parseExpr i expr of
275 case parseExpr i expr of
275− Left err -> do iputStrLn . show . fixColour c . parseErrorDoc $ err
276+ Left err -> do iWarn (errorExtent err) (Util.Pretty.text $ errorMessage err)
276 runIO $ exitWith (ExitFailure 1)
277 runIO $ exitWith (ExitFailure 1)
277 Right term -> do ctxt <- getContext
278 Right term -> do ctxt <- getContext
278 (tm, _) <- elabVal (recinfo (fileFC "toplevel")) ERHS term
279 (tm, _) <- elabVal (recinfo (fileFC "toplevel")) ERHS term
@@ -299,7 +300,7 @@ initScript = do script <- runIO $ getIdrisInitScript
299 runInit h
300 runInit h
300 processLine i cmd input clr =
301 processLine i cmd input clr =
301 case parseCmd i input cmd of
302 case parseCmd i input cmd of
302− Left err -> runIO . print . fixColour clr . parseErrorDoc $ err
303+ Left err -> iWarn (errorExtent err) (Util.Pretty.text $ errorMessage err)
303 Right (Right Reload) -> iPrintError "Init scripts cannot reload the file"
304 Right (Right Reload) -> iPrintError "Init scripts cannot reload the file"
304 Right (Right (Load f _)) -> iPrintError "Init scripts cannot load files"
305 Right (Right (Load f _)) -> iPrintError "Init scripts cannot load files"
305 Right (Right (ModImport f)) -> iPrintError "Init scripts cannot import modules"
306 Right (Right (ModImport f)) -> iPrintError "Init scripts cannot import modules"