diff --git a/.gitignore b/.gitignore index b2fb732..75822e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.hython_history .stack-work .cabal-sandbox *.hi diff --git a/src/Main.hs b/src/Main.hs index ff42bec..4fa8788 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -1,6 +1,7 @@ module Main (main) where +import Control.Applicative import Control.Exception import Control.Monad.IO.Class (liftIO) @@ -27,7 +28,7 @@ main = do runREPL :: IO () runREPL = do state <- defaultInterpreterState - runInputT defaultSettings (loop state) + runInputT settings (loop state) where loop state = do input <- getInputLine ">>> " @@ -42,12 +43,12 @@ runREPL = do loop newState + settings = defaultSettings { historyFile = Just ".hython_history" } + runScript :: String -> IO () runScript filename = do code <- readFile filename `catch` errorHandler filename - - state <- defaultInterpreterState - _ <- runInterpreter state code + _ <- runInterpreter <$> defaultInterpreterState <*> pure code return () where