3import System.Console.Readline
5import System.Environment
9import Control.Monad.State
12import Core.ShellParser
23-- Main program reads command line options, parses the main program, and gets
26data Opt = Filename String
31main = do xs <- getArgs
33 execStateT (runIdris opts) idrisInit
35runIdris :: [Opt] -> Idris ()
37 do let inputs = opt getFile opts
38 when (OLogging `elem` opts) (setOpt Logging True)
39 mapM_ loadModule inputs
42loadModule :: FilePath -> Idris ()
43loadModule f = do iLOG ("Reading " ++ show f)
47 iLOG (show (idris_infixes i))
50dumpDecls :: [PDecl] -> String
52dumpDecls (d:ds) = dumpDecl d ++ "\n" ++ dumpDecls ds
54dumpDecl (PFix f ops) = show f ++ " " ++ showSep ", " ops
55dumpDecl (PTy n t) = "tydecl " ++ show n ++ " : " ++ showImp True t
56dumpDecl (PClause l r) = "pat " ++ showImp True l ++ " = " ++ showImp True r
57dumpDecl (PData d) = "data " ++ showDImp True d
59getFile :: Opt -> Maybe String
60getFile (Filename str) = Just str
63opt :: (Opt -> Maybe a) -> [Opt] -> [a]
66usage = do putStrLn "You're doing it wrong"
67 exitWith (ExitFailure 1)
69parseArgs :: [String] -> IO [Opt]
70parseArgs [] = return []
71parseArgs ("--log":ns) = liftM (OLogging : ) (parseArgs ns)
72parseArgs (n:ns) = liftM (Filename n : ) (parseArgs ns)
76 = do f <- readFile "test.mi"
81 case checkProgram emptyContext defs of
82 OK ctxt -> do print (toAlist ctxt)
83 runShell (initState ctxt)
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