on master help sign in
Allow querying the registered error handlers
commit3b0678820f3a04630ca749a2795764d8eca0fbb2 authorDavid Christiansen <david@davidchristiansen.dk> dateTue 17 Dec 2013, 16:18 (13 years ago) parent0b6cab7
3 files changed+8
src/Idris/AbsSyntaxTree.hs+1 src/Idris/REPL.hs+6 src/Idris/REPLParser.hs+1
src/Idris/AbsSyntaxTree.hs+1
@@ -261,6 +261,7 @@ data Command = Quit
261261 | SetColour ColourType IdrisColour
262262 | ColourOn
263263 | ColourOff
264+ | ListErrorHandlers
264265
265266data Opt = Filename String
266267 | Ver
src/Idris/REPL.hs+6
@@ -925,6 +925,12 @@ process h fn ColourOn
925925process h fn ColourOff
926926 = do ist <- getIState
927927 putIState $ ist { idris_colourRepl = False }
928+process h fn ListErrorHandlers =
929+ do ist <- getIState
930+ case idris_errorhandlers ist of
931+ [] -> iPrintResult "No registered error handlers"
932+ handlers ->
933+ iPrintResult $ "Registered error handlers: " ++ (concat . intersperse ", " . map show) handlers
928934
929935classInfo :: ClassInfo -> Idris ()
930936classInfo ci = do iputStrLn "Methods:\n"
src/Idris/REPLParser.hs+1
@@ -96,6 +96,7 @@ pCmd = do P.whiteSpace; try (do cmd ["q", "quit"]; eof; return Quit)
9696 eof; return (AddProof n))
9797 <|> try (do cmd ["x"]; P.whiteSpace; t <- P.fullExpr defaultSyntax; return (ExecVal t))
9898 <|> try (do cmd ["patt"]; P.whiteSpace; t <- P.fullExpr defaultSyntax; return (Pattelab t))
99+ <|> try (do cmd ["errorhandlers"]; eof ; return ListErrorHandlers)
99100 <|> do P.whiteSpace; do eof; return NOP
100101 <|> do t <- P.fullExpr defaultSyntax; return (Eval t)
101102