-withVirtualPath :: GHCi a -> GHCi a
-withVirtualPath m = do
- ghci_wd <- io getCurrentDirectory -- Store the cwd of GHCi
- st <- getGHCiState
- io$ setCurrentDirectory (virtual_path st)
- result <- m -- Evaluate in the virtual wd..
- vwd <- io getCurrentDirectory
- setGHCiState (st{ virtual_path = vwd}) -- Update the virtual path
- io$ setCurrentDirectory ghci_wd -- ..and restore GHCi wd
- return result
-