-
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
stack init --solver
should install and use its own GHC
#1149
Comments
Looks like a dupe of #1072, which was implemented on master. Can you try out the latest master and see if it works for you? |
Not working on 0.1.6.0:
I did |
@wereHamster Are you sure this is the same error? I think the The messages here are kind of unclear, should be clarified which part is actually an error and what is just for information. |
Fair point about GHC being installed. Though my larger goal of this issue was to make If you prefer to close this issue and open a new one for making |
Much like Stack doesn't install GHC automatically (it requires you to run I suppose an argument could be made that having an option to install tools automatically could exist (like |
PR #1583 adds support for |
What is the reason not to install GHC automatically, i.e invert the logic and provide a |
I agree with @wereHamster, let's make it a default! I don't think it can succeed without having the right ghc installed, right? So may as well default to solving this issue. |
Installing GHC is an infrequent but a bit expensive (might be subjective) operation taking a bit more resources (time, bandwidth, space) than any other everyday operations. I like least user intervention and doing the right thing automatically but it might come with surprises sometimes. A user may not expect it to do something like that and she may have the GHC installed already but not on path, or may want to use a different snapshot/GHC version which is already installed. A middle ground might be to interactively prompt the user for a yes/no for install, with a yes as the default. This behavior can be based on whether we have a terminal otherwise use the command line control. Changing the default is easier though. We can try that and see if anyone complains! |
The current default came about from people complaining about a tool doing On Sun, Jan 3, 2016, 9:11 AM Harendra Kumar [email protected]
|
It doesn't make sense to create a new stack project without having a compiler on the system. If it is clearly visible in the output what stack is doing (eg. "Compiler not found, installing GHC 7.10.3"), the user can easily abort the operation (^C) and investigate. I wouldn't use prompts or anything that requires interaction because that makes automated installs harder. For bandwidth constrained environments it may be better to ask for permission for every network access, regardless of size (eg. "Need to download GHC 7.10.3 (approx. 248MB). Continue? [y/n]: "). Also, the size of all dependencies of an average project is about the same as GHC, so I don't see why we should have to explicitly allow one but not the other. |
You still have command line control (--install-ghc) for automated installs, if you use the right command line option no prompts will be displayed. Prompting for every network access might be inconvenient. IIRC @mgsloan proposed a But this debate is about the default for a specific case of GHC. If it is true that average dependency download is of the same order as GHC then excepting GHC may not make sense. Installed size might still be a consideration though. Here is the tar and installed size of GHC on my machine:
I am not sure if that is big or small, may depend on the setup and the user. |
I can certainly see the potential for frustration when automatically downloading something. I've blown through my cellphone data before because I ^C'ed a docker pull and it kept on going in the background. Argh! So yeah, lets not do that. As @wereHamster mentions, how about having I'm not sure if it'd be worth the complexity of making snapshot search / selection interactive, but that's also something that could be considered. |
Currently stack init --solver cannot be used with a specific resolver. It just uses the GHC on your path and provides a compiler resolver corresponding to that GHC and all deps are extra deps. Instead, we want to be able to use a specific snapshot and only deps not matching the snapshot should be extra deps. This commit is a step towards that goal. 1) '--solver' is now a switch which can be used along with a resolver. 'stack init --resolver lts-2.22 --solver' will now be a valid init command. 2) Snapshot selector now returns the snapshot with least number of dependency errors as a partial match. This snapshot is to be used by the solver. Note that the solver is not yet changed to work on an existing snapshot. That will come in a future commit. 3) We now report an explicit error when the specified resolver does not have a compiler compatible with the package dependencies. 4) Note a behavior change for the 'stack init --resolver' command. Earlier it used to write the stack.yaml file even if it did not successully resolve all packages. Now it will fail in that case and suggest '--solver' to resolve the extra dependencies. 5) Separate the snapshot selection interface from the snapshot dependency check interface. 6) Some error message reporting changes.
I believe this issue has come to resolution, closing. |
I thought one of the reasons for stack is that it can be used to manage GHC. However, when I try to init a project with
--solver
(can't use stackage because of version incompatibilities), I get this:I was expecting stack to automatically use the latest stable GHC automatically (currently 7.10.x). Cabal does find a valid build plan when using GH 7.10.
The text was updated successfully, but these errors were encountered: