on master help sign in
Rename to emitWarning
37b4861Jason Felice
src/Idris/Main.hs+3−3
@@ -195,7 +195,7 @@ idrisMain opts =
195 mapM_ (\str -> do ist <- getIState
195 mapM_ (\str -> do ist <- getIState
196 c <- colourise
196 c <- colourise
197 case parseExpr ist str of
197 case parseExpr ist str of
198− Left err -> do emit err
198+ Left err -> do emitWarning err
199 runIO $ exitWith (ExitFailure 1)
199 runIO $ exitWith (ExitFailure 1)
200 Right e -> process "" (Eval e))
200 Right e -> process "" (Eval e))
201 exprs
201 exprs
@@ -272,7 +272,7 @@ execScript :: String -> Idris ()
272execScript expr = do i <- getIState
272execScript expr = do i <- getIState
273 c <- colourise
273 c <- colourise
274 case parseExpr i expr of
274 case parseExpr i expr of
275− Left err -> do emit err
275+ Left err -> do emitWarning err
276 runIO $ exitWith (ExitFailure 1)
276 runIO $ exitWith (ExitFailure 1)
277 Right term -> do ctxt <- getContext
277 Right term -> do ctxt <- getContext
278 (tm, _) <- elabVal (recinfo (fileFC "toplevel")) ERHS term
278 (tm, _) <- elabVal (recinfo (fileFC "toplevel")) ERHS term
@@ -299,7 +299,7 @@ initScript = do script <- runIO $ getIdrisInitScript
299 runInit h
299 runInit h
300 processLine i cmd input clr =
300 processLine i cmd input clr =
301 case parseCmd i input cmd of
301 case parseCmd i input cmd of
302− Left err -> emit err
302+ Left err -> emitWarning err
303 Right (Right Reload) -> iPrintError "Init scripts cannot reload the file"
303 Right (Right Reload) -> iPrintError "Init scripts cannot reload the file"
304 Right (Right (Load f _)) -> iPrintError "Init scripts cannot load files"
304 Right (Right (Load f _)) -> iPrintError "Init scripts cannot load files"
305 Right (Right (ModImport f)) -> iPrintError "Init scripts cannot import modules"
305 Right (Right (ModImport f)) -> iPrintError "Init scripts cannot import modules"
src/Idris/Output.hs+10−9
@@ -9,12 +9,13 @@ Maintainer : The Idris Community.
9{-# LANGUAGE FlexibleInstances #-}
9{-# LANGUAGE FlexibleInstances #-}
10{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
10{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
11
11
12−module Idris.Output (clearHighlights, emit, formatMessage, idemodePutSExp, iPrintError, iPrintFunTypes,
12+module Idris.Output (clearHighlights, emitWarning, formatMessage, idemodePutSExp,
13− iPrintResult, iPrintTermWithType, iputGoal, iputStr, iputStrLn,
13+ iPrintError, iPrintFunTypes, iPrintResult, iPrintTermWithType,
14+ iputGoal, iputStr, iputStrLn, iRender, iRenderError,
14− iRender, iRenderError, iRenderOutput, iRenderResult, iWarn,
15+ iRenderOutput, iRenderResult, iWarn, prettyDocumentedIst,
15− prettyDocumentedIst, printUndefinedNames, pshow, renderExternal,
16+ printUndefinedNames, pshow, renderExternal, sendHighlighting,
16− sendHighlighting, sendParserHighlighting, warnTotality,
17+ sendParserHighlighting, warnTotality, writeHighlights,
17− writeHighlights, OutputDoc(..), Message(..)) where
18+ OutputDoc(..), Message(..)) where
18
19
19import Idris.AbsSyntax
20import Idris.AbsSyntax
20import Idris.Colours (hEndColourise, hStartColourise)
21import Idris.Colours (hEndColourise, hStartColourise)
@@ -173,10 +174,10 @@ formatMessage w = do
173 layoutMessage loc Nothing err = loc </> err
174 layoutMessage loc Nothing err = loc </> err
174
175
175iWarn :: FC -> OutputDoc -> Idris ()
176iWarn :: FC -> OutputDoc -> Idris ()
176−iWarn fc err = emit $ SimpleWarning fc err
177+iWarn fc err = emitWarning $ SimpleWarning fc err
177
178
178−emit :: Message w => w -> Idris ()
179+emitWarning :: Message w => w -> Idris ()
179−emit w =
180+emitWarning w =
180 do i <- getIState
181 do i <- getIState
181 case idris_outputmode i of
182 case idris_outputmode i of
182 RawOutput h ->
183 RawOutput h ->
src/Idris/Parser.hs+1−1
@@ -1525,7 +1525,7 @@ parseProg :: SyntaxInfo -> FilePath -> String -> Maybe Mark -> Idris [PDecl]
1525parseProg syn fname input mrk
1525parseProg syn fname input mrk
1526 = do i <- getIState
1526 = do i <- getIState
1527 case runparser mainProg i fname input of
1527 case runparser mainProg i fname input of
1528− Left err -> do emit err
1528+ Left err -> do emitWarning err
1529 i <- getIState
1529 i <- getIState
1530 putIState (i { errSpan = Just (messageExtent err) })
1530 putIState (i { errSpan = Just (messageExtent err) })
1531 return []
1531 return []
src/Idris/REPL.hs+1−1
@@ -726,7 +726,7 @@ processInput cmd orig inputs efile
726 let quiet = opt_quiet opts
726 let quiet = opt_quiet opts
727 let fn = fromMaybe "" (listToMaybe inputs)
727 let fn = fromMaybe "" (listToMaybe inputs)
728 case parseCmd i "(input)" cmd of
728 case parseCmd i "(input)" cmd of
729− Left err -> Just inputs <$ emit err
729+ Left err -> Just inputs <$ emitWarning err
730 Right (Right Reload) ->
730 Right (Right Reload) ->
731 reload orig inputs
731 reload orig inputs
732 Right (Right Watch) ->
732 Right (Right Watch) ->