eagletmt/ghcmod-vim — pull request #12 by adimit (2012-07-05 22:27:43+00:00)
Title: Add a way to make ghc-mod's execution directory customizable

This allows us to modify from where ghcmod is executed. Always executing
it from the folder the current file resides in can cause problems with,
for example, Yesod's scaffolding, where some of the splices expect files
to live in certain places relative to the compiler's working directory.

To explain, consider the following: use `yesod init` to create a new default Yesod project, and cd to the new project's directory. Then:

% ghc-mod check Settings/StaticFiles.hs
# no problems reported
% cd Settings
% ghc-mod check StaticFiles.hs
# returns: StaticFiles.hs:1:1:Exception when trying to run compile-time code: static: getDirectoryContents: does not exist (No such file or directory) Code: staticFiles staticDir

Making it possible to set ghc-mod's working directory explicitly allows the user to use Yesod's default scaffolding with ghcmod-vim. There might be another fix, but I can't think of any.