@@ -19,7 +19,7 @@ import Core.ProofShell
19import Core.TT
19import Core.TT
20import Core.Constraints
20import Core.Constraints
22−import System.Console.Readline
22+import System.Console.Haskeline
23import System.FilePath
23import System.FilePath
24import System.Environment
24import System.Environment
25import System.Process
25import System.Process
@@ -33,12 +33,11 @@ import Data.Version
33repl :: IState -> [FilePath] -> Idris ()
33repl :: IState -> [FilePath] -> Idris ()
34repl orig mods
34repl orig mods
35 = do let prompt = mkPrompt mods
35 = do let prompt = mkPrompt mods
36− x <- lift $ readline (prompt ++ "> ")
36+ x <- lift $ getInputLine (prompt ++ "> ")
38 Nothing -> do iputStrLn "Bye bye"
38 Nothing -> do iputStrLn "Bye bye"
40− Just input -> do lift $ addHistory input
41− ms <- processInput input orig mods
40+ Just input -> do ms <- processInput input orig mods
42 case ms of
41 case ms of
43 Just mods -> repl orig mods
42 Just mods -> repl orig mods
44 Nothing -> return ()
43 Nothing -> return ()
@@ -54,7 +53,7 @@ processInput cmd orig inputs
54 (f:_) -> f
53 (f:_) -> f
56 case parseCmd i cmd of
55 case parseCmd i cmd of
57− Left err -> do lift $ print err
56+ Left err -> do liftIO $ print err
58 return (Just inputs)
57 return (Just inputs)
59 Right Reload -> do put (orig { idris_options = idris_options i })
58 Right Reload -> do put (orig { idris_options = idris_options i })
@@ -75,13 +74,13 @@ edit :: FilePath -> IState -> Idris ()
75edit "" orig = iputStrLn "Nothing to edit"
74edit "" orig = iputStrLn "Nothing to edit"
76edit f orig
75edit f orig
77 = do i <- get
76 = do i <- get
78− env <- lift $ getEnvironment
77+ env <- liftIO $ getEnvironment
79 let editor = getEditor env
78 let editor = getEditor env
80 let line = case errLine i of
79 let line = case errLine i of
81 Just l -> " +" ++ show l ++ " "
80 Just l -> " +" ++ show l ++ " "
82 Nothing -> " "
81 Nothing -> " "
83 let cmd = editor ++ line ++ f
82 let cmd = editor ++ line ++ f
84− lift $ system cmd
83+ liftIO $ system cmd
86 put (orig { idris_options = idris_options i })
85 put (orig { idris_options = idris_options i })
87 loadModule f
86 loadModule f
@@ -95,13 +94,13 @@ addProof :: FilePath -> IState -> Idris ()
95addProof "" orig = iputStrLn "Nothing to add to"
94addProof "" orig = iputStrLn "Nothing to add to"
96addProof f orig
95addProof f orig
97 = do let fb = f ++ "~"
96 = do let fb = f ++ "~"
98− lift $ copyFile f fb -- make a backup in case something goes wrong!
97+ liftIO $ copyFile f fb -- make a backup in case something goes wrong!
99− prog <- lift $ readFile fb
98+ prog <- liftIO $ readFile fb
101 case last_proof i of
100 case last_proof i of
102 Nothing -> iputStrLn "No proof to add"
101 Nothing -> iputStrLn "No proof to add"
103 Just (n, p) -> do let prog' = insertScript (showProof n p) (lines prog)
102 Just (n, p) -> do let prog' = insertScript (showProof n p) (lines prog)
104− lift $ writeFile f (unlines prog')
103+ liftIO $ writeFile f (unlines prog')
105 iputStrLn $ "Added proof " ++ show n
104 iputStrLn $ "Added proof " ++ show n
106 put (i { last_proof = Nothing })
105 put (i { last_proof = Nothing })
107 -- lift $ removeFile fb -- uncomment when less scared :)
106 -- lift $ removeFile fb -- uncomment when less scared :)
@@ -141,14 +140,14 @@ process (Check t) = do (tm, ty) <- elabVal toplevel False t
141process Universes = do i <- get
140process Universes = do i <- get
142 let cs = idris_constraints i
141 let cs = idris_constraints i
143-- iputStrLn $ showSep "\n" (map show cs)
142-- iputStrLn $ showSep "\n" (map show cs)
144− lift $ print (map fst cs)
143+ liftIO $ print (map fst cs)
145 let n = length cs
144 let n = length cs
146 iputStrLn $ "(" ++ show n ++ " constraints)"
145 iputStrLn $ "(" ++ show n ++ " constraints)"
147 case ucheck cs of
146 case ucheck cs of
148 Error e -> iputStrLn $ pshow i e
147 Error e -> iputStrLn $ pshow i e
149 OK _ -> iputStrLn "Universes OK"
148 OK _ -> iputStrLn "Universes OK"
150process (Defn n) = do ctxt <- getContext
149process (Defn n) = do ctxt <- getContext
151− lift $ print (lookupDef Nothing n ctxt)
150+ liftIO $ print (lookupDef Nothing n ctxt)
152process (Spec t) = do (tm, ty) <- elabVal toplevel False t
151process (Spec t) = do (tm, ty) <- elabVal toplevel False t
153 ctxt <- getContext
152 ctxt <- getContext
154 ist <- get
153 ist <- get
@@ -165,7 +164,7 @@ process TTShell = do ist <- get
165 shst' <- lift $ runShell shst
164 shst' <- lift $ runShell shst
166 return ()
165 return ()
167process (Execute f) = do compile f
166process (Execute f) = do compile f
168− lift $ system ("./" ++ f)
167+ liftIO $ system ("./" ++ f)
169 return ()
168 return ()
170process (Compile f) = do compile f
169process (Compile f) = do compile f
171process (LogLvl i) = setLogLevel i
170process (LogLvl i) = setLogLevel i