1{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
11import Control.Monad.State
12import System.Console.Readline
14data ShellState = State { ctxt :: Context,
15 prf :: Maybe ProofState,
19initState c = State c Nothing False
21processCommand :: Command -> ShellState -> (ShellState, String)
22processCommand (Theorem n ty) state
23 = case check (ctxt state) [] ty of
24 OK (gl, Set _) -> (state { prf = Just (newProof n (ctxt state) gl) }, "")
25 OK _ -> (state, "Goal is not a type")
26 err -> (state, show err)
27processCommand Quit state = (state { exitNow = True }, "Bye bye")
28processCommand (Tac t) state
29 | Just ps <- prf state = case processTactic t ps of
30 OK (ps', resp) -> (state { prf = Just ps' }, resp)
31 err -> (state, show err)
32 | otherwise = (state, "No proof in progress")
34runShell :: ShellState -> IO ShellState
35runShell st = do (prompt, parser) <-
36 maybe (return ("> ", parseCommand))
38 return (show (thname st) ++ "> ", parseTactic))
42 Nothing -> return $ Right Quit
43 Just input -> do addHistory input
46 Left err -> do putStrLn (show err)
48 Right cmd -> do let (st', r) = processCommand cmd st
50 if (not (exitNow st')) then runShell st'
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list