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

Package-wide extensions propagate to packages included in the stack.yaml file when running stack repl #1806

Closed
LukaHorvat opened this issue Feb 18, 2016 · 2 comments
Milestone

Comments

@LukaHorvat
Copy link

I have two projects. One is a yesod web site and it references the other project. The way I do this is by adding the git url of the second project to the yesod one in it's stack.yaml. This works fine with stack build, but it doesn't work with stack repl. I get errors when ghci processes files from the second project because that project expects Prelude to be implicitly imported.

There are two sources where the extension is mentioned. It's set in the yesod project's cabal file and it's set in the .ghci file.

I don't really know what to do about this. If I remove the extensions from the .ghci file, the yesod project doesn't build, but if I keep them there the other project doesn't build.

There's also some weird interaction happening when I add or remove the extensions from the cabal file. What can I do about this?

Again, stack build works fine. Is there a way to avoid having to interpret the other project at all? Why can't it just work like it does for other packages I include from stackage?

@mgsloan
Copy link
Contributor

mgsloan commented Feb 19, 2016

stack ghci will tell you that there are mismatched extension flags and that this will . There are plans to reduce the number of extensions specified in the cabal file for yesod templates - yesodweb/yesod-scaffold#109 . The workaround is to remove them from the extensions in cabal and moving them to {-# LANGUAGE ... #-} pragmas in the modules that need it.

There isn't anything we can do about this - having stack ghci load multiple packages is really a hack that just happens to work decently in practice. Doing it properly will require support from GHC: https://ghc.haskell.org/trac/ghc/ticket/10827

@mgsloan mgsloan added this to the Support milestone Feb 19, 2016
@mgsloan mgsloan closed this as completed Feb 19, 2016
@mgsloan
Copy link
Contributor

mgsloan commented Feb 19, 2016

Is there a way to avoid having to interpret the other project at all? Why can't it just work like it does for other packages I include from stackage?

Since it's in the packages list, it's treated as a local package. You probably need extra-dep: True for that package. Yeah, I don't like that very much.. This will probably be cleaned up, hopefully soonish, by resolving the following issues: #1265 #1217 #1501

By default, stack ghci loads up all executable and library components of every local package. You could also do stack ghci my-main-package to only load that package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants