mirror of
https://github.com/idris-lang/Idris-dev.git
synced 2024-10-04 01:50:20 +03:00
Merge pull request #4871 from melted/haskeline
Fix to unblock haskeline-0.8
This commit is contained in:
commit
8ea1ec1816
@ -336,7 +336,7 @@ Library
|
||||
, directory >= 1.2.2.0 && < 1.2.3.0 || > 1.2.3.0
|
||||
, filepath < 1.5
|
||||
, fingertree >= 0.1.4.1 && < 0.2
|
||||
, haskeline >= 0.7 && < 0.8
|
||||
, haskeline >= 0.8 && < 0.9
|
||||
, ieee754 >= 0.7 && < 0.9
|
||||
, megaparsec >= 7.0.4 && < 9
|
||||
, mtl >= 2.1 && < 2.3
|
||||
|
@ -37,21 +37,13 @@ import Prelude hiding ((<$>))
|
||||
#endif
|
||||
|
||||
import Control.Arrow (first)
|
||||
import Control.Monad.Trans.Except (ExceptT(ExceptT), runExceptT)
|
||||
import Data.List (intersperse, nub)
|
||||
import Data.Maybe (fromJust, fromMaybe, isJust, listToMaybe)
|
||||
import qualified Data.Set as S
|
||||
import System.Console.Haskeline.MonadException (MonadException(controlIO),
|
||||
RunIO(RunIO))
|
||||
import System.FilePath (replaceExtension)
|
||||
import System.IO (Handle, hPutStr, hPutStrLn)
|
||||
import System.IO.Error (tryIOError)
|
||||
|
||||
instance MonadException m => MonadException (ExceptT Err m) where
|
||||
controlIO f = ExceptT $ controlIO $ \(RunIO run) -> let
|
||||
run' = RunIO (fmap ExceptT . run . runExceptT)
|
||||
in fmap runExceptT $ f run'
|
||||
|
||||
pshow :: IState -> Err -> String
|
||||
pshow ist err = displayDecorated (consoleDecorate ist) .
|
||||
renderPretty 1.0 80 .
|
||||
|
@ -122,23 +122,21 @@ repl orig mods efile
|
||||
(if colour && not isWindows
|
||||
then colourisePrompt theme str
|
||||
else str) ++ " "
|
||||
x <- H.catch (H.withInterrupt $ getInputLine prompt)
|
||||
(ctrlC (return $ Just ""))
|
||||
x <- H.handleInterrupt (ctrlC (return $ Just "")) (H.withInterrupt $ getInputLine prompt)
|
||||
case x of
|
||||
Nothing -> do lift $ when (not quiet) (iputStrLn "Bye bye")
|
||||
return ()
|
||||
Just input -> -- H.catch
|
||||
do ms <- H.catch (H.withInterrupt $ lift $ processInput input orig mods efile)
|
||||
(ctrlC (return (Just mods)))
|
||||
do ms <- H.handleInterrupt (ctrlC (return (Just mods))) (H.withInterrupt $ lift $ processInput input orig mods efile)
|
||||
case ms of
|
||||
Just mods -> let efile' = fromMaybe efile (listToMaybe mods)
|
||||
in repl orig mods efile'
|
||||
Nothing -> return ()
|
||||
-- ctrlC)
|
||||
-- ctrlC
|
||||
where ctrlC :: InputT Idris a -> SomeException -> InputT Idris a
|
||||
ctrlC act e = do lift $ iputStrLn (show e)
|
||||
act -- repl orig mods
|
||||
where ctrlC :: InputT Idris a -> InputT Idris a
|
||||
ctrlC act = do lift $ iputStrLn "Interrupted"
|
||||
act -- repl orig mods
|
||||
|
||||
showMVs c thm [] = ""
|
||||
showMVs c thm ms = "Holes: " ++
|
||||
|
Loading…
Reference in New Issue
Block a user