@@ -80,31 +80,33 @@ repl :: IState -- ^ The initial state
8080 -> [FilePath] -- ^ The loaded modules
8181 -> InputT Idris ()
8282repl orig mods
83− = H.catch
84− (do let quiet = opt_quiet (idris_options orig)
85− i <- lift getIState
86− let colour = idris_colourRepl i
87− let theme = idris_colourTheme i
88− let mvs = idris_metavars i
89− let prompt = if quiet
90− then ""
91− else showMVs colour theme mvs ++
92− let str = mkPrompt mods ++ ">" in
93− (if colour then colourisePrompt theme str else str) ++ " "
94− x <- getInputLine prompt
95− case x of
96− Nothing -> do lift $ when (not quiet) (iputStrLn "Bye bye")
97− return ()
98− Just input -> H.catch
99− (do ms <- lift $ processInput input orig mods
100− case ms of
101− Just mods -> repl orig mods
102− Nothing -> return ())
103− ctrlC)
104− ctrlC
105− where ctrlC :: SomeException -> InputT Idris ()
106− ctrlC e = do lift $ iputStrLn (show e)
107− repl orig mods
83+ = -- H.catch
84+ do let quiet = opt_quiet (idris_options orig)
85+ i <- lift getIState
86+ let colour = idris_colourRepl i
87+ let theme = idris_colourTheme i
88+ let mvs = idris_metavars i
89+ let prompt = if quiet
90+ then ""
91+ else showMVs colour theme mvs ++
92+ let str = mkPrompt mods ++ ">" in
93+ (if colour then colourisePrompt theme str else str) ++ " "
94+ x <- H.catch (getInputLine prompt)
95+ (ctrlC (return Nothing))
96+ case x of
97+ Nothing -> do lift $ when (not quiet) (iputStrLn "Bye bye")
98+ return ()
99+ Just input -> -- H.catch
100+ do ms <- H.catch (lift $ processInput input orig mods)
101+ (ctrlC (return (Just mods)))
102+ case ms of
103+ Just mods -> repl orig mods
104+ Nothing -> return ()
105+-- ctrlC)
106+-- ctrlC
107+ where ctrlC :: InputT Idris a -> SomeException -> InputT Idris a
108+ ctrlC act e = do lift $ iputStrLn (show e)
109+ act -- repl orig mods
108110
109111 showMVs c thm [] = ""
110112 showMVs c thm ms = "Metavariables: " ++
@@ -1193,8 +1195,8 @@ idrisMain opts =
11931195 when (not (NoPrelude `elem` opts)) $ do x <- loadModule stdout "Prelude"
11941196 return ()
11951197 when (runrepl && not quiet && not idesl && not (isJust script) && not nobanner) $ iputStrLn banner
1196− ist <- getIState
11971198
1199+ orig <- getIState
11981200 loadInputs stdout inputs
11991201
12001202 runIO $ hSetBuffering stdout LineBuffering
@@ -1219,9 +1221,9 @@ idrisMain opts =
12191221
12201222 when (runrepl && not idesl) $ do
12211223 initScript
1222− startServer ist inputs
1223− runInputT (replSettings (Just historyFile)) $ repl ist inputs
1224− when (idesl) $ ideslaveStart ist inputs
1224+ startServer orig inputs
1225+ runInputT (replSettings (Just historyFile)) $ repl orig inputs
1226+ when (idesl) $ ideslaveStart orig inputs
12251227 ok <- noErrors
12261228 when (not ok) $ runIO (exitWith (ExitFailure 1))
12271229 where