Skip to content

Commit

Permalink
Make :module work more like :load.
Browse files Browse the repository at this point in the history
Fixes #1313
  • Loading branch information
yav committed Jan 13, 2022
1 parent 34404d7 commit dd29bc6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Cryptol/REPL/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,9 +1124,18 @@ moduleCmd :: String -> REPL ()
moduleCmd modString
| null modString = return ()
| otherwise = do
case parseModName modString of
Just m -> loadHelper (M.loadModuleByName m)
Nothing -> rPutStrLn "Invalid module name."
case parseModName modString of
Just m
| M.isParamInstModName m -> loadHelper (M.loadModuleByName m)
| otherwise ->
do mpath <- liftModuleCmd (M.findModule m)
case mpath of
M.InFile file ->
do setEditPath file
setLoadedMod LoadedModule { lName = Just m, lPath = mpath }
loadHelper (M.loadModuleByPath file)
M.InMem {} -> loadHelper (M.loadModuleByName m)
Nothing -> rPutStrLn "Invalid module name."

loadPrelude :: REPL ()
loadPrelude = moduleCmd $ show $ pp M.preludeName
Expand Down

0 comments on commit dd29bc6

Please sign in to comment.