-
Notifications
You must be signed in to change notification settings - Fork 841
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
After creating second executable, stack ghci no longer able to load library modules #3582
Comments
Ok, I traced the problem to the Main file being included by both my first and second executables. In the hpack file they both had the same Once I moved my second executable's main to a different directory, then the stack behavior of letting you pick a specific executable worked fine. |
I see! Yes, stack should probably support use of Glad there's a workaround, though. |
Awesome, thanks @mgsloan! |
@mgsloan Related to this, is there any way to have a default target for stack, to avoid specifying it on the command line each time? |
There is not a way to do that currently. There was some discussion somewhere, can't easily find it now, of allowing specification of default One approach I've used is to just create a bash alias for the ghci invocation that I tend to do. |
This seems to apply to |
General summary/comments
After adding a second executable,
stack ghci
prompts me to choose which executable I want to load (or none). Regardless of my choice, the REPL is no longer able to load modules from my library.Meta: I haven't made many second executables in the same project before, so possibly I messed something up there? It seems pretty straightforward though and felt like a bug.
Steps to reproduce
Note: This repo has a reproduction of the issue: https://github.com/MaxGabriel/StackGhciIssue. The repo is generated from
stack new stack-issue haskeleton
, which is pretty barebones.Steps:
stack new stack-issue haskeleton
cd stack-issue
stack ghci
to confirm it works.Main2.hs
file to the executables directory. Copy the contents ofMain.hs
into it.stack ghci
Expected
stack ghci
worked, and allowed me to import modules from my library.Actual
stack ghci
asked me which executable to use, or none. Every option chosen is unable to import modules from the library. In the repo reproducing the issue, I get the error message:When I try this in a scaffolded Yesod repo, I get a similar error message, but my modules are listed as being part of a hidden package:
I'm able to workaround this issue in the Yesod repo by doing:
stack ghci packageName:executableName
, which lets me import modules from my Yesod app. I'm not able to get this workaround to work in the repo reproducing the issue, I'm not sure why.Output of
stack ghci
in verbose mode, pressing enter to choose neither executable: https://gist.github.com/MaxGabriel/56e2efe78312ebc62aa4e7c319da16a2Stack version
I also tested with:
Method of installation
The text was updated successfully, but these errors were encountered: