on master help sign in
Moved info show functions to library.

Added module to show Idris information. It doesn't belong in the main module.

commitc8668142908cc618cea9b89bcde32c3d333175c2 authorJan de Muijnck-Hughes <jfdm@st-andrews.ac.uk> dateSun 7 Aug 2016, 19:41 (10 years ago) parent757b76f
3 files changed+44−29
idris.cabal+1 main/Main.hs+6−29 src/Idris/Info/Show.hs+37
idris.cabal+1
@@ -189,6 +189,7 @@ Library
189189 , Idris.IdrisDoc
190190 , Idris.Imports
191191 , Idris.Info
192+ , Idris.Info.Show
192193 , Idris.Inliner
193194 , Idris.Interactive
194195 , Idris.Output
main/Main.hs+6−29
@@ -10,6 +10,7 @@ import Idris.REPL
1010import Idris.Error
1111import Idris.CmdOptions
1212import Idris.Info
13+import Idris.Info.Show
1314import Idris.Package
1415
1516
@@ -28,11 +29,11 @@ main = do opts <- runArgParser
2829runIdris :: [Opt] -> Idris ()
2930runIdris opts = do
3031 runIO setupBundledCC
31− when (ShowLoggingCats `elem` opts) $ runIO showLoggingCats
32− when (ShowIncs `elem` opts) $ runIO showIncs
33− when (ShowLibs `elem` opts) $ runIO showLibs
34− when (ShowLibdir `elem` opts) $ runIO showLibdir
35− when (ShowPkgs `elem` opts) $ runIO showPkgs
32+ when (ShowLoggingCats `elem` opts) $ runIO showIdrisLoggingCategories
33+ when (ShowIncs `elem` opts) $ runIO showIdrisFlagsInc
34+ when (ShowLibs `elem` opts) $ runIO showIdrisFlagsLibs
35+ when (ShowLibdir `elem` opts) $ runIO showIdrisLibDir
36+ when (ShowPkgs `elem` opts) $ runIO showIdrisInstalledPackages
3637 case opt getClient opts of
3738 [] -> return ()
3839 (c:_) -> do setVerbose False
@@ -61,27 +62,3 @@ runIdris opts = do
6162 [f] -> replPkg opts f
6263 _ -> ifail "Too many packages"
6364 fs -> runIO $ mapM_ (buildPkg opts (WarnOnly `elem` opts)) fs
64−
65−showLibs :: IO b
66−showLibs = do libFlags <- getIdrisFlagsLib
67− putStrLn $ unwords libFlags
68− exitSuccess
69−
70−showLibdir :: IO b
71−showLibdir = do putStrLn =<< getIdrisLibDir
72− exitSuccess
73−
74−showIncs :: IO b
75−showIncs = do incFlags <- getIdrisFlagsInc
76− putStrLn $ unwords incFlags
77− exitSuccess
78−
79−-- | List idris packages installed
80−showPkgs :: IO b
81−showPkgs = do mapM_ putStrLn =<< getIdrisInstalledPackages
82− exitSuccess
83−
84−showLoggingCats :: IO b
85−showLoggingCats = do
86− mapM_ putStrLn =<< getIdrisLoggingCategories
87− exitSuccess
src/Idris/Info/Show.hsnew file+37
@@ -0,0 +1,37 @@
1+module Idris.Info.Show where
2+
3+import System.Exit
4+
5+import Idris.Info
6+
7+
8+showIdrisFlagsLibs :: IO b
9+showIdrisFlagsLibs = do
10+ libFlags <- getIdrisFlagsLib
11+ putStrLn $ unwords libFlags
12+ exitSuccess
13+
14+showIdrisLibDir :: IO b
15+showIdrisLibDir = do
16+ ldir <- getIdrisLibDir
17+ putStrLn ldir
18+ exitSuccess
19+
20+showIdrisFlagsInc :: IO b
21+showIdrisFlagsInc = do
22+ incFlags <- getIdrisFlagsInc
23+ putStrLn $ unwords incFlags
24+ exitSuccess
25+
26+-- | List idris packages installed
27+showIdrisInstalledPackages :: IO b
28+showIdrisInstalledPackages = do
29+ ipkgs <- getIdrisInstalledPackages
30+ mapM_ putStrLn ipkgs
31+ exitSuccess
32+
33+showIdrisLoggingCategories :: IO b
34+showIdrisLoggingCategories = do
35+ cs <- getIdrisLoggingCategories
36+ mapM_ putStrLn cs
37+ exitSuccess