Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hs-source-dirs starting with ../ are not included in the -i<dir> arguments when using stack ghci file.hs #2895

tallen-imvu opened this issue Jan 4, 2017 · 4 comments


Copy link


stack ghci <target file> will correctly determine include directories using the cabal file's hs-source-dirs property unless the source directory starts with a ../
stack build however deals with this correctly.

Steps to reproduce

  1. add a relative path to hs-source-dirs:
    hs-source-dirs: . ../extra

  2. Add a module to the ../extra directory and import it in your main file

  3. run command stack build
    everything should work

  4. run command stack ghci <path to main>


ghci launched with package loaded


Error in compiling due to failing to load the extra module. Because it cannot find it.

running the stack ghci command with --version shows that the ../extra directory is not being added to the list of -i<directory> flags passed to ghci.
If the module is moved to a directory that does not require a ../ prefix, then that directory is included properly.

Stack version

$ stack --version
Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 (4395 commits) x86_64 hpack-0.15.0

Method of installation

Copy link

mgsloan commented Jan 6, 2017

Hmm, I cannot reproduce the issue. For me if I have

  hs-source-dirs:      src ../issue2895-extra
  exposed-modules:     Lib Huh

It works (Huh.hs is in ../issue2895-extra). Perhaps your module is not listed in exposed-modules / other-modules?

Copy link
Contributor Author

I put up a reproducing repo here

Copy link
Contributor Author

Oh, there it is.
It is the parseRelDir on line 423 of src/Stack/Package.hs
Pull request incomming

mgsloan added a commit that referenced this issue Jan 31, 2017
for 'stack ghci', don't omit hsSourceDirs that have '..' in them. #2895
Copy link

mgsloan commented Jan 31, 2017

Thanks for finding and fixing!!

@mgsloan mgsloan closed this as completed Jan 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants