@@ -12,7 +12,7 @@ module Idris.REPL(
12 getClient, getPkg, getPkgCheck, getPkgClean, getPkgMkDoc
12 getClient, getPkg, getPkgCheck, getPkgClean, getPkgMkDoc
13 , getPkgREPL, getPkgTest, getPort, getIBCSubDir
13 , getPkgREPL, getPkgTest, getPort, getIBCSubDir
14 , idris, idrisMain, loadInputs
14 , idris, idrisMain, loadInputs
15− , opt, runClient, runMain, ver
15+ , opt, runClient, runMain
18import Idris.AbsSyntax
18import Idris.AbsSyntax
@@ -55,6 +55,8 @@ import Idris.Elab.Data
55import Idris.Elab.Value
55import Idris.Elab.Value
56import Idris.Elab.Term
56import Idris.Elab.Term
58import Version_idris (gitHash)
60import Version_idris (gitHash)
59import Util.System
61import Util.System
60import Util.DynamicLinker
62import Util.DynamicLinker
@@ -71,7 +73,7 @@ import Idris.Core.Constraints
71import IRTS.Compiler
73import IRTS.Compiler
72import IRTS.CodegenCommon
74import IRTS.CodegenCommon
73import IRTS.Exports
75import IRTS.Exports
74−import IRTS.System
76+--import IRTS.System
76import Control.Category
78import Control.Category
77import qualified Control.Exception as X
79import qualified Control.Exception as X
@@ -567,7 +569,7 @@ runIdeModeCommand h id orig fn modes (IdeMode.ErrPPrint e) =
567 msg = (IdeMode.SymbolAtom "ok", out, spans)
569 msg = (IdeMode.SymbolAtom "ok", out, spans)
568 runIO . hPutStrLn h $ IdeMode.convSExp "return" msg id
570 runIO . hPutStrLn h $ IdeMode.convSExp "return" msg id
569runIdeModeCommand h id orig fn modes IdeMode.GetIdrisVersion =
571runIdeModeCommand h id orig fn modes IdeMode.GetIdrisVersion =
570− let idrisVersion = (versionBranch version,
572+ let idrisVersion = (versionBranch getIdrisVersionNoGit,
571 if not (null gitHash)
573 if not (null gitHash)
572 then [gitHash]
574 then [gitHash]
@@ -1472,7 +1474,7 @@ showTotalN ist n = case lookupTotal n (tt_ctxt ist) of
1472 showN n = annotate (AnnName n Nothing Nothing Nothing) . text $
1474 showN n = annotate (AnnName n Nothing Nothing Nothing) . text $
1473 showName (Just ist) [] ppo False n
1475 showName (Just ist) [] ppo False n
1475−displayHelp = let vstr = showVersion version in
1477+displayHelp = let vstr = showVersion getIdrisVersionNoGit in
1476 "\nIdris version " ++ vstr ++ "\n" ++
1478 "\nIdris version " ++ vstr ++ "\n" ++
1477 "--------------" ++ map (\x -> '-') vstr ++ "\n\n" ++
1479 "--------------" ++ map (\x -> '-') vstr ++ "\n\n" ++
1478 concatMap cmdInfo helphead ++
1480 concatMap cmdInfo helphead ++
@@ -1799,13 +1801,13 @@ idrisMain opts =
1799 Just expr -> execScript expr
1801 Just expr -> execScript expr
1801 -- Create Idris data dir + repl history and config dir
1803 -- Create Idris data dir + repl history and config dir
1802− idrisCatch (do dir <- getIdrisUserDataDir
1804+ idrisCatch (do dir <- runIO $ getIdrisUserDataDir
1803 exists <- runIO $ doesDirectoryExist dir
1805 exists <- runIO $ doesDirectoryExist dir
1804 unless exists $ logLvl 1 ("Creating " ++ dir)
1806 unless exists $ logLvl 1 ("Creating " ++ dir)
1805 runIO $ createDirectoryIfMissing True (dir </> "repl"))
1807 runIO $ createDirectoryIfMissing True (dir </> "repl"))
1806 (\e -> return ())
1808 (\e -> return ())
1808− historyFile <- fmap (</> "repl" </> "history") getIdrisUserDataDir
1810+ historyFile <- runIO $ getIdrisHistoryFile
1810 when ok $ case opt getPkgIndex opts of
1812 when ok $ case opt getPkgIndex opts of
1811 (f : _) -> writePkgIndex f
1813 (f : _) -> writePkgIndex f
@@ -1850,18 +1852,10 @@ execScript expr = do i <- getIState
1850 res <- execute tm
1852 res <- execute tm
1851 runIO $ exitSuccess
1853 runIO $ exitSuccess
1853−-- | Get the platform-specific, user-specific Idris dir
1854−getIdrisUserDataDir :: Idris FilePath
1855−getIdrisUserDataDir = runIO $ getAppUserDataDirectory "idris"
1857−-- | Locate the platform-specific location for the init script
1858−getInitScript :: Idris FilePath
1859−getInitScript = do idrisDir <- getIdrisUserDataDir
1860− return $ idrisDir </> "repl" </> "init"
1862-- | Run the initialisation script
1856-- | Run the initialisation script
1863initScript :: Idris ()
1857initScript :: Idris ()
1864−initScript = do script <- getInitScript
1858+initScript = do script <- runIO $ getIdrisInitScript
1865 idrisCatch (do go <- runIO $ doesFileExist script
1859 idrisCatch (do go <- runIO $ doesFileExist script
1866 when go $ do
1860 when go $ do
1867 h <- runIO $ openFile script ReadMode
1861 h <- runIO $ openFile script ReadMode
@@ -1873,7 +1867,7 @@ initScript = do script <- getInitScript
1873 ist <- getIState
1867 ist <- getIState
1874 unless eof $ do
1868 unless eof $ do
1875 line <- runIO $ hGetLine h
1869 line <- runIO $ hGetLine h
1876− script <- getInitScript
1870+ script <- runIO $ getIdrisInitScript
1877 c <- colourise
1871 c <- colourise
1878 processLine ist line script c
1872 processLine ist line script c
1879 runInit h
1873 runInit h
@@ -2011,16 +2005,17 @@ getPort (_:xs) = getPort xs
2011opt :: (Opt -> Maybe a) -> [Opt] -> [a]
2005opt :: (Opt -> Maybe a) -> [Opt] -> [a]
2012opt = mapMaybe
2006opt = mapMaybe
2014ver = showVersion version ++ suffix
2009ver = showVersion version ++ suffix
2016 suffix = if gitHash =="" then "" else "-" ++ gitHash
2011 suffix = if gitHash =="" then "" else "-" ++ gitHash
2018defaultPort :: PortID
2013defaultPort :: PortID
2019defaultPort = PortNumber (fromIntegral 4294)
2014defaultPort = PortNumber (fromIntegral 4294)
2021banner = " ____ __ _ \n" ++
2016banner = " ____ __ _ \n" ++
2022 " / _/___/ /____(_)____ \n" ++
2017 " / _/___/ /____(_)____ \n" ++
2023− " / // __ / ___/ / ___/ Version " ++ ver ++ "\n" ++
2018+ " / // __ / ___/ / ___/ Version " ++ getIdrisVersion ++ "\n" ++
2024 " _/ // /_/ / / / (__ ) http://www.idris-lang.org/ \n" ++
2019 " _/ // /_/ / / / (__ ) http://www.idris-lang.org/ \n" ++
2025 " /___/\\__,_/_/ /_/____/ Type :? for help \n" ++
2020 " /___/\\__,_/_/ /_/____/ Type :? for help \n" ++