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 = let (ps', resp) = processTactic t ps in
30 (state { prf = Just ps' }, resp)
31 | otherwise = (state, "No proof in progress")
33runShell :: ShellState -> IO ShellState
34runShell st = do prompt <- maybe (return "> ")
35 (\st -> do print st; return (show (thname st) ++ "> "))
39 Nothing -> return $ Right Quit
40 Just input -> do addHistory input
41 return (parseCommand input)
43 Left err -> do putStrLn (show err)
45 Right cmd -> do let (st', r) = processCommand cmd st
47 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