@@ -4,12 +4,10 @@ import System.Console.Haskeline
4import System.IO
4import System.IO
5import System.Environment
5import System.Environment
6import System.Exit
6import System.Exit
7−import System.FilePath ((</>), addTrailingPathSeparator)
8import System.Directory
7import System.Directory
10import Data.Maybe
9import Data.Maybe
11import Data.Version
10import Data.Version
12−import Control.Monad.Trans.State.Strict ( execStateT, get, put )
13import Control.Monad ( when )
11import Control.Monad ( when )
15import Idris.Core.TT
13import Idris.Core.TT
@@ -44,66 +42,65 @@ main = do opts <- runArgParser
45runIdris :: [Opt] -> Idris ()
43runIdris :: [Opt] -> Idris ()
46runIdris opts = do
44runIdris opts = do
47− runIO setupBundledCC
45+ runIO setupBundledCC
48− when (ShowLoggingCats `elem` opts) $ runIO showLoggingCats
46+ when (ShowLoggingCats `elem` opts) $ runIO showLoggingCats
49− when (ShowIncs `elem` opts) $ runIO showIncs
47+ when (ShowIncs `elem` opts) $ runIO showIncs
50− when (ShowLibs `elem` opts) $ runIO showLibs
48+ when (ShowLibs `elem` opts) $ runIO showLibs
51− when (ShowLibdir `elem` opts) $ runIO showLibdir
49+ when (ShowLibdir `elem` opts) $ runIO showLibdir
52− when (ShowPkgs `elem` opts) $ runIO showPkgs
50+ when (ShowPkgs `elem` opts) $ runIO showPkgs
53− case opt getClient opts of
51+ case opt getClient opts of
54− [] -> return ()
52+ [] -> return ()
55− (c:_) -> do setVerbose False
53+ (c:_) -> do setVerbose False
56− setQuiet True
54+ setQuiet True
57− runIO $ runClient (getPort opts) c
55+ runIO $ runClient (getPort opts) c
58− runIO $ exitWith ExitSuccess
56+ runIO exitSuccess
59− case opt getPkgCheck opts of
57+ case opt getPkgCheck opts of
60− [] -> return ()
58+ [] -> return ()
61− fs -> do runIO $ mapM_ (checkPkg (WarnOnly `elem` opts) True) fs
59+ fs -> do runIO $ mapM_ (checkPkg (WarnOnly `elem` opts) True) fs
62− runIO $ exitWith ExitSuccess
60+ runIO exitSuccess
63− case opt getPkgClean opts of
61+ case opt getPkgClean opts of
64− [] -> return ()
62+ [] -> return ()
65− fs -> do runIO $ mapM_ cleanPkg fs
63+ fs -> do runIO $ mapM_ cleanPkg fs
66− runIO $ exitWith ExitSuccess
64+ runIO exitSuccess
67− case opt getPkgMkDoc opts of -- IdrisDoc
65+ case opt getPkgMkDoc opts of -- IdrisDoc
68− [] -> return ()
66+ [] -> return ()
69− fs -> do runIO $ mapM_ documentPkg fs
67+ fs -> do runIO $ mapM_ documentPkg fs
70− runIO $ exitWith ExitSuccess
68+ runIO exitSuccess
71− case opt getPkgTest opts of
69+ case opt getPkgTest opts of
72− [] -> return ()
70+ [] -> return ()
73− fs -> do runIO $ mapM_ testPkg fs
71+ fs -> do runIO $ mapM_ testPkg fs
74− runIO $ exitWith ExitSuccess
72+ runIO exitSuccess
75− case opt getPkg opts of
73+ case opt getPkg opts of
76− [] -> case opt getPkgREPL opts of
74+ [] -> case opt getPkgREPL opts of
77− [] -> idrisMain opts
75+ [] -> idrisMain opts
78− [f] -> replPkg f
76+ [f] -> replPkg f
79− _ -> ifail "Too many packages"
77+ _ -> ifail "Too many packages"
80− fs -> runIO $ mapM_ (buildPkg (WarnOnly `elem` opts)) fs
78+ fs -> runIO $ mapM_ (buildPkg (WarnOnly `elem` opts)) fs
82showver :: IO b
80showver :: IO b
83showver = do putStrLn $ "Idris version " ++ ver
81showver = do putStrLn $ "Idris version " ++ ver
84− exitWith ExitSuccess
82+ exitSuccess
86showLibs :: IO b
84showLibs :: IO b
87showLibs = do libFlags <- getLibFlags
85showLibs = do libFlags <- getLibFlags
88 putStrLn $ unwords libFlags
86 putStrLn $ unwords libFlags
89− exitWith ExitSuccess
87+ exitSuccess
91showLibdir :: IO b
89showLibdir :: IO b
92−showLibdir = do dir <- getIdrisLibDir
90+showLibdir = do putStrLn =<< getIdrisLibDir
93− putStrLn dir
91+ exitSuccess
96showIncs :: IO b
93showIncs :: IO b
97showIncs = do incFlags <- getIncFlags
94showIncs = do incFlags <- getIncFlags
98 putStrLn $ unwords incFlags
95 putStrLn $ unwords incFlags
99− exitWith ExitSuccess
96+ exitSuccess
101-- | List idris packages installed
98-- | List idris packages installed
102showPkgs :: IO b
99showPkgs :: IO b
103showPkgs = do mapM putStrLn =<< installedPackages
100showPkgs = do mapM putStrLn =<< installedPackages
104− exitWith ExitSuccess
101+ exitSuccess
106showLoggingCats :: IO b
103showLoggingCats :: IO b
107showLoggingCats = do
104showLoggingCats = do
108 putStrLn loggingCatsStr
105 putStrLn loggingCatsStr
109− exitWith ExitSuccess
106+ exitSuccess