Remember the path when editing.

This commit is contained in:
Iavor Diatchki 2017-10-27 10:21:50 -07:00
parent 2faa44e17b
commit 35a3843685
2 changed files with 5 additions and 1 deletions

View File

@ -742,6 +742,7 @@ editCmd path
| otherwise = do
_ <- replEdit path
setEditPath path
reloadCmd
moduleCmd :: String -> REPL ()

View File

@ -40,7 +40,7 @@ module Cryptol.REPL.Monad (
, getTypeNames
, getPropertyNames
, getModNames
, LoadedModule(..), getLoadedMod, setLoadedMod, clearLoadedMod
, LoadedModule(..), getLoadedMod, setLoadedMod, clearLoadedMod, setEditPath
, setSearchPath, prependSearchPath
, getPrompt
, shouldContinue
@ -313,6 +313,9 @@ setLoadedMod n = do
modifyRW_ (\ rw -> rw { eLoadedMod = Just n })
updateREPLTitle
setEditPath :: FilePath -> REPL ()
setEditPath p = setLoadedMod LoadedModule { lName = Nothing, lPath = p }
getLoadedMod :: REPL (Maybe LoadedModule)
getLoadedMod = eLoadedMod `fmap` getRW