@@ -82,6 +82,10 @@ processInput cmd orig inputs
82 Right AddProof -> do idrisCatch (addProof fn orig)
82 Right AddProof -> do idrisCatch (addProof fn orig)
83 (\e -> iputStrLn (show e))
83 (\e -> iputStrLn (show e))
84 return (Just inputs)
84 return (Just inputs)
85+ Right RmProof -> do rmProof orig
87+ Right Proofs -> do proofs orig
85 Right Quit -> do iputStrLn "Bye bye"
89 Right Quit -> do iputStrLn "Bye bye"
86 return Nothing
90 return Nothing
87 Right cmd -> do idrisCatch (process fn cmd)
91 Right cmd -> do idrisCatch (process fn cmd)
@@ -115,13 +119,31 @@ addProof f orig
115 liftIO $ copyFile f fb -- make a backup in case something goes wrong!
119 liftIO $ copyFile f fb -- make a backup in case something goes wrong!
116 prog <- liftIO $ readFile fb
120 prog <- liftIO $ readFile fb
118− case last_proof i of
122+ case proof_list i of
119− Nothing -> iputStrLn "No proof to add"
123+ [] -> iputStrLn "No proof to add"
120− Just (n, p) -> do let prog' = insertScript (showProof (lit f) n p) (lines prog)
124+ (n, p) : proofs -> do let prog' = insertScript (showProof (lit f) n p) (lines prog)
121− liftIO $ writeFile f (unlines prog')
125+ liftIO $ writeFile f (unlines prog')
122− iputStrLn $ "Added proof " ++ show n
126+ iputStrLn $ "Added proof " ++ show n
123− put (i { last_proof = Nothing })
127+ put (i { proof_list = proofs })
124− -- lift $ removeFile fb -- uncomment when less scared :)
128+ -- lift $ removeFile fb -- uncomment when less scared :)
130+rmProof :: IState -> Idris ()
133+ case proof_list i of
134+ [] -> iputStrLn "Nothing to remove"
135+ (n, p) : ps -> do iputStrLn $ "Removed proof " ++ show n
136+ let metavars = idris_metavars i
137+ put (i { proof_list = ps
138+ , idris_metavars = n : metavars
141+proofs :: IState -> Idris ()
144+ case proof_list i of
145+ [] -> iputStrLn "No proofs"
146+ ps -> mapM_ (\(n, p) -> iputStrLn $ showProof False n p) ps
126insertScript :: String -> [String] -> [String]
148insertScript :: String -> [String] -> [String]
127insertScript prf [] = "\n---------- Proofs ----------" : "" : [prf]
149insertScript prf [] = "\n---------- Proofs ----------" : "" : [prf]
@@ -332,6 +354,8 @@ help =
332 ([":m",":metavars"], "", "Show remaining proof obligations (metavariables)"),
354 ([":m",":metavars"], "", "Show remaining proof obligations (metavariables)"),
333 ([":p",":prove"], "<name>", "Prove a metavariable"),
355 ([":p",":prove"], "<name>", "Prove a metavariable"),
334 ([":a",":addproof"], "", "Add last proof to source file"),
356 ([":a",":addproof"], "", "Add last proof to source file"),
357+ ([":rmproof"], "", "Remove last proof from proof stack"),
358+ ([":proofs"], "", "Show proof stack"),
335 ([":c",":compile"], "<filename>", "Compile to an executable <filename>"),
359 ([":c",":compile"], "<filename>", "Compile to an executable <filename>"),
336 ([":exec",":execute"], "", "Compile to an executable and run"),
360 ([":exec",":execute"], "", "Compile to an executable and run"),
337 ([":?",":h",":help"], "", "Display this help text"),
361 ([":?",":h",":help"], "", "Display this help text"),