on master help sign in
Allow querying the registered error handlers
commit75933d6e83270ea1c87b0fbe019c70c1111320b1 authorDavid Christiansen <david@davidchristiansen.dk> dateTue 17 Dec 2013, 16:18 (13 years ago) parent82fe0c6
3 files changed+8
src/Idris/AbsSyntaxTree.hs+1 src/Idris/REPL.hs+6 src/Idris/REPLParser.hs+1
src/Idris/AbsSyntaxTree.hs+1
@@ -260,6 +260,7 @@ data Command = Quit
260260 | SetColour ColourType IdrisColour
261261 | ColourOn
262262 | ColourOff
263+ | ListErrorHandlers
263264
264265data Opt = Filename String
265266 | Ver
src/Idris/REPL.hs+6
@@ -907,6 +907,12 @@ process h fn ColourOn
907907process h fn ColourOff
908908 = do ist <- getIState
909909 putIState $ ist { idris_colourRepl = False }
910+process h fn ListErrorHandlers =
911+ do ist <- getIState
912+ case idris_errorhandlers ist of
913+ [] -> iPrintResult "No registered error handlers"
914+ handlers ->
915+ iPrintResult $ "Registered error handlers: " ++ (concat . intersperse ", " . map show) handlers
910916
911917classInfo :: ClassInfo -> Idris ()
912918classInfo 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