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