@@ -57,8 +57,7 @@ import Data.Ord
5757import qualified Data.Text as T
5858import qualified System.Directory as Dir (makeAbsolute)
5959import System.FilePath
60−import Text.PrettyPrint.ANSI.Leijen (Doc, plain)
61−import qualified Text.PrettyPrint.ANSI.Leijen as ANSI
60+import qualified Text.PrettyPrint.ANSI.Leijen as PP
6261import Text.Trifecta ((<?>))
6362import qualified Text.Trifecta as P
6463import qualified Text.Trifecta.Delta as P
@@ -1478,19 +1477,19 @@ runElabDecl syn =
14781477
14791478{- * Loading and parsing -}
14801479{-| Parses an expression from input -}
1481−parseExpr :: IState -> String -> Either P.ErrInfo PTerm
1480+parseExpr :: IState -> String -> Either ParseError PTerm
14821481parseExpr st = runparser (fullExpr defaultSyntax) st "(input)"
14831482
14841483{-| Parses a constant form input -}
1485−parseConst :: IState -> String -> Either P.ErrInfo Const
1484+parseConst :: IState -> String -> Either ParseError Const
14861485parseConst st = runparser (fmap fst constant) st "(input)"
14871486
14881487{-| Parses a tactic from input -}
1489−parseTactic :: IState -> String -> Either P.ErrInfo PTactic
1488+parseTactic :: IState -> String -> Either ParseError PTactic
14901489parseTactic st = runparser (fullTactic defaultSyntax) st "(input)"
14911490
14921491{-| Parses a do-step from input (used in the elab shell) -}
1493−parseElabShellStep :: IState -> String -> Either P.ErrInfo (Either ElabShellCmd PDo)
1492+parseElabShellStep :: IState -> String -> Either ParseError (Either ElabShellCmd PDo)
14941493parseElabShellStep ist = runparser (Right <$> do_ defaultSyntax <|> Left <$> elabShellCmd) ist "(input)"
14951494 where elabShellCmd = char ':' >>
14961495 (reserved "qed" >> pure EQED ) <|>
@@ -1553,8 +1552,8 @@ parseImports fname input
15531552 shebang = string "#!" *> many (P.satisfy $ not . isEol) *> eol *> pure ()
15541553
15551554-- | There should be a better way of doing this...
1556−findFC :: Doc -> (FC, String)
1557−findFC x = let s = show (plain x) in findFC' s
1555+findFC :: PP.Doc -> (FC, String)
1556+findFC x = let s = show (PP.plain x) in findFC' s
15581557 where findFC' s = case span (/= ':') s of
15591558 -- Horrid kludge to prevent crashes on Windows
15601559 (prefix, ':':'\\':rest) ->
@@ -1568,8 +1567,8 @@ findFC x = let s = show (plain x) in findFC' s
15681567 (FC failname pos pos, msg)
15691568
15701569-- | Check if the coloring matches the options and corrects if necessary
1571−fixColour :: Bool -> ANSI.Doc -> ANSI.Doc
1572−fixColour False doc = ANSI.plain doc
1570+fixColour :: Bool -> PP.Doc -> PP.Doc
1571+fixColour False doc = PP.plain doc
15731572fixColour True doc = doc
15741573
15751574-- | A program is a list of declarations, possibly with associated
@@ -1579,17 +1578,17 @@ parseProg :: SyntaxInfo -> FilePath -> String -> Maybe P.Delta ->
15791578parseProg syn fname input mrk
15801579 = do i <- getIState
15811580 case runparser mainProg i fname input of
1582− Left (P.ErrInfo doc _) -> do -- FIXME: Get error location from trifecta
1583− -- this can't be the solution!
1584− -- Issue #1575 on the issue tracker.
1585− -- https://github.com/idris-lang/Idris-dev/issues/1575
1586− let (fc, msg) = findFC doc
1587− i <- getIState
1588− case idris_outputmode i of
1589− RawOutput h -> iputStrLn (show $ fixColour (idris_colourRepl i) doc)
1590− IdeMode n h -> iWarn fc (Util.Pretty.text msg)
1591− putIState (i { errSpan = Just fc })
1592− return []
1581+ Left doc -> do -- FIXME: Get error location from trifecta
1582+ -- this can't be the solution!
1583+ -- Issue #1575 on the issue tracker.
1584+ -- https://github.com/idris-lang/Idris-dev/issues/1575
1585+ let (fc, msg) = findFC doc
1586+ i <- getIState
1587+ case idris_outputmode i of
1588+ RawOutput h -> iputStrLn (show $ fixColour (idris_colourRepl i) doc)
1589+ IdeMode n h -> iWarn fc (Util.Pretty.text msg)
1590+ putIState (i { errSpan = Just fc })
1591+ return []
15931592 Right (x, i) -> do putIState i
15941593 reportParserWarnings
15951594 return $ collect x