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
39 mapM_ loadModule inputs
42 makeOption (OLogging i) = setLogLevel i
43 makeOption _ = return ()
45loadModule :: FilePath -> Idris ()
46loadModule f = do iLOG ("Reading " ++ show f)
50 iLOG (show (idris_infixes i))
51 -- Now add all the declarations to the context
52 elabDecl (PData inferDecl) -- a handy primitive
56dumpDecls :: [PDecl] -> String
58dumpDecls (d:ds) = dumpDecl d ++ "\n" ++ dumpDecls ds
60dumpDecl (PFix f ops) = show f ++ " " ++ showSep ", " ops
61dumpDecl (PTy n t) = "tydecl " ++ show n ++ " : " ++ showImp True t
62dumpDecl (PClauses n cs) = "pat\t" ++ showSep "\n\t" (map (showCImp True) cs)
63dumpDecl (PData d) = showDImp True d
65getFile :: Opt -> Maybe String
66getFile (Filename str) = Just str
69opt :: (Opt -> Maybe a) -> [Opt] -> [a]
72usage = do putStrLn "You're doing it wrong"
73 exitWith (ExitFailure 1)
75parseArgs :: [String] -> IO [Opt]
76parseArgs [] = return []
77parseArgs ("--log":lvl:ns) = liftM (OLogging (read lvl) : ) (parseArgs ns)
78parseArgs (n:ns) = liftM (Filename n : ) (parseArgs ns)
82 = do f <- readFile "test.mi"
87 case checkProgram emptyContext defs of
88 OK ctxt -> do print (toAlist ctxt)
89 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