-
Notifications
You must be signed in to change notification settings - Fork 710
Resolve project, package and component from anywhere. #7471
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
Comments
To clarify: in the strong way, do you mean that if there is no other plausible choice, the default stuff is going to be chosen (and initialized, if not present yet)? I'm confused by "wire into Cabal how to resolve a project" not mentioning 'default'. The weak way is clear. BTW, my personal preference is for the strong way. I'd specify the location of the default project in the ~/.cabal/config file and, as discussed in issues about CABAL_STORE variable, the location of ~/.cabal/config can be overridden by environment variable and that's the only variable we ever need, because everything else can be specified in the (overridden) config file. |
Yes. I see it like this:
So, we make a best effort to resolve into something locally sensible, and fall through onto the default project if all else fails. |
This isn't simple as that. In my opinion it shouldn't, i just want The implicit global package will add a new implicit thing, and ruin all the work done to try to remove implicit assumptions from The less implicit stuff |
What is to stop My understanding is that The way to assure quality is to verify the properties of the few core functions and then make sure that all convenience functions are nothing but combinations of the verified core. |
@kindaro: the problem with |
Oh, I see. So |
What if we say that |
From a coding point of view, I think However, I'm more worried about the semantics. We'd need to check what the users use and preserve it and offer them a good story, competitive to "like |
Mikolaj, could you please articulate the nature of the split you are mentioning? I see 2 possible readings: A. The split between So, there are so far 4 scenarios to consider. I actually find all of them to be problematic in one way or another. For example, suppose I say This unearths the realization that
Is this the right way to put the question forward? |
The split I have in mind (but there may be better lines of divide; this one was in response to the problem with the auto-created default central project conflicting with the project (directory) in which
To reword the idea: it may be helpful to have As I said, this is a messy idea, but I don't have a better solution to the conflict of the potential two conflicting project configurations. |
Oh, and I mean only the exe-installing |
there is more sources to install, no? you can install a local (and remote?) tarball, you could install from a git repo, not sure if they will fit some of the other two |
Right. The differentiating factor might be if you want the project config present (by chance perhaps?) in your current directory to affect the installation. That solves a few cases. I have no idea how installing from a git repo address works currently --- does it clone the repo and run cabal inside the cloned directory, in effect using the project configuration from that directory instead of from Anyway, we could even allow all kinds of targets (with sufficient disambiguation) for both ways of resolving project configuration. So, in a project directory with a package directory I don't think this is a good idea, but it demonstrates the design space we need to prune. |
It would be good in many ways if Cabal resolved some project, package and component from anywhere on the file system. To name a few:
ghci
as a calculator. One can add their favourite dependencies and language extensions, andcabal repl
would respect that.There are two ways to accomplish this.
The strong way.
The strong way is to wire into Cabal how to resolve a project, package and component from anywhere in the file system. Properties:
This assumes that a default project is always there. Cabal would initialize it as needed.
The weak way.
The weak way is to make Cabal respect an environment variable pointing to a default project but otherwise behave the same. We still require backwards compatibility, but not totality. Currently, there are two ways to resolve a project, in the order of precedence:
--project-file
.cabal.project
or*.cabal
anywhere in or above the current working directory.We add another way:
So, due to its lower precedence, Cabal will ignore the environment variable if already in a project or a package.
Cabal will not uniquely resolve a package or a component if there are several of them in the project pointed at, so annoying errors stay. This way only covers the calculator use case. The user is responsible for setting the project up and wiring it into Cabal via the environment variable.
We can also combine both ways: have hard wired defaulting and allow overriding the default project, package and component by an environment variable. This would allow one to swap the default project at will.
This has been previously discussed in #6481.
I can write the code.
The text was updated successfully, but these errors were encountered: