Skip to content

Commit

Permalink
REPL stores history in CWD
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgreen committed Jul 18, 2015
1 parent 0c53810 commit c098b94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
.hython_history
.stack-work
.cabal-sandbox
*.hi
Expand Down
9 changes: 5 additions & 4 deletions src/Main.hs
@@ -1,6 +1,7 @@
module Main (main)
where

import Control.Applicative
import Control.Exception
import Control.Monad.IO.Class (liftIO)

Expand All @@ -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 ">>> "
Expand All @@ -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
Expand Down

0 comments on commit c098b94

Please sign in to comment.