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))
48 -- Now add all the declarations to the context
52dumpDecls :: [PDecl] -> String
54dumpDecls (d:ds) = dumpDecl d ++ "\n" ++ dumpDecls ds
56dumpDecl (PFix f ops) = show f ++ " " ++ showSep ", " ops
57dumpDecl (PTy n t) = "tydecl " ++ show n ++ " : " ++ showImp True t
58dumpDecl (PClauses cs) = "pat\t" ++ showSep "\n\t" (map (showCImp True) cs)
59dumpDecl (PData d) = showDImp True d
61getFile :: Opt -> Maybe String
62getFile (Filename str) = Just str
65opt :: (Opt -> Maybe a) -> [Opt] -> [a]
68usage = do putStrLn "You're doing it wrong"
69 exitWith (ExitFailure 1)
71parseArgs :: [String] -> IO [Opt]
72parseArgs [] = return []
73parseArgs ("--log":ns) = liftM (OLogging : ) (parseArgs ns)
74parseArgs (n:ns) = liftM (Filename n : ) (parseArgs ns)
78 = do f <- readFile "test.mi"
83 case checkProgram emptyContext defs of
84 OK ctxt -> do print (toAlist ctxt)
85 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