Changing directories in GHC Monad

☆樱花仙子☆ 提交于 2019-12-08 07:33:02

问题


Looking at ghc package documentation i found this function:

workingDirectoryChanged :: GhcMonad m => m ()

Inform GHC that the working directory has changed. GHC will flush its cache of module locations, since it may no longer be valid.

Note: Before changing the working directory make sure all threads running in the same session have stopped. If you change the working directory, you should also unload the current program (set targets to empty, followed by load).

I need to run loaded code and compile expressions while changing directories. Is there any way/workaround to this?

One solution i can think of is having separate directory, and setting workdir to that directory whenever interpreter is to be invoked, then restoring old pwd, but i'm not sure if it will work or if this is the best solution.

来源:https://stackoverflow.com/questions/45659935/changing-directories-in-ghc-monad

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!