Repository navigation
Description
Continuing from this discussion here: https://twitter.com/bkmlep/status/1427696844662919169
What is this RFC for?
Discussion amongst the Cabal team has led us to consider the idea of supporting Stackage Nightly snapshots and LTS (Long Term Support) releases. This issue should serve as a preliminary request for comment and the start of a design document for supporting Stackage LTS snapshots and features associated with it.
Why should I care?
LTS snapshots support closed universes of package sets that are guaranteed to work together. Many of us already work with Nix, which relies on Stackage to inform its stable package sets. Working with Cabal + Nix is already implicitly working in an LTS. This would be a good feature for Cabal to support, due to many users strictly consuming dependencies, in which case they do not care in particular about setting bounds, which is a feature for library maintainers and consumers who need finer grained dependency management.
With #6528, we could support LTS snapshots as remote freeze files, and allow users to consume other kinds of stable package sets.
When will this go in?
At least 1 year (Cabal 3.10), at most 2 years (Cabal 3.14)
I like this, how can I help?
Speak up on this issue, or get ahold of one of the Cabal team on libera.chat#hackage
Activity
parsonsmatt commentedon Aug 18, 2021
[admin edit, by @Mikolaj: the PVP section mentioned below has since been removed from the main post]
I'd love to be able to point
cabalto a Stackage resolver. That would be fantastic.I agree with gbaz - I'm not sure why PVP and version bounds are being discussed here. After some thought, I'm curious if you're intending to support a
resolverattribute as a package-level property? If so, then I can see how it would be relevant - suppose someone has a.cabalfile likeWhile the
resolverin this case specifies the versions of the libraries in question, it does not specify any version bounds. So the intent may be to take the bounds fromlts-14.5and force them to be equal in thebuild-dependsupon publish to Hackage or similar.I can see that feature being useful as an application developer, to avoid having a
cabal.projectorstack.yamlfile. However, having those files is so useful for other things that I don't see that as a huge pain point. And, since we'd need to support something likeextra-depsinstack.yamlto provide non-resolver dependencies, I don't think complicating the.cabalfile format any further makes much sense.As a library developer, I would not want to commit to
== library-version.in.resolver, and would not use the feature in that context.Having a
--resolverflag on the CLI would be great for doing builds and specifying a known-good set of dependencies. And havingresolveras a property in thecabal.projectfile would also be fantastic, though you would want to copyextra-depstoo.emilypi commentedon Aug 18, 2021
@parsonsmatt I removed the PVP commentary - @gbaz talked me down off the ledge 😄
gbaz commentedon Aug 18, 2021
(deleted my earlier comments since the issue was edited)
I'd be against setting resolvers as a package level property, as packages can work with much larger sets of version bounds than in a single resolver, and furthermore that info would make it hard to back-into full dep sets for solving without a lot of extra fetching. Having a minimal
cabal.projectfile seems fine (and note that i'd imagine we'd be able to set remote freeze files directly as a command line flag to configure).#6528 covers remote freeze files, and i think the only slightly subtle design work is caching. The remaining aspect to bridging this is either having stackage again more prominently expose its freeze files, or creating a more general
stack-package-set.yaml -> freeze filebridge as a service, which wouldn't be much work either.I'd also like to improve hackage-server support for storing and serving package sets, which is some design work but maybe a gsoc worth of code (at most).
Gabriella439 commentedon Aug 18, 2021
My understanding is the same as @gbaz: resolvers should be a project-level property, not a package-level property. This would also be consistent with how Nix and Stack work
jkachmar commentedon Aug 18, 2021
At a high-level I think something like this would be quite useful for all the reasons you've listed; I don't really have much to add to this other than to be another voice of support.
Thanks for starting this conversation and writing up the RFC!
Do you think it would be useful to have something like
gen-boundswhich would use the dependency info from the snapshot specified in acabal.projectfile to generate lower bounds?parsonsmatt commentedon Aug 18, 2021
It'd be nice to have a list of resolvers that I intend on supporting, with version bounds specified by those resolvers if not otherwise present. This would make it easier to have accurate version bounds when trying to support a wide range of dependencies.
angerman commentedon Aug 18, 2021
Having support for fixed/curated package sets is certainly something I support. And I've mentioned this a long time ago, we could support this almost today if we allowed hackage-overlays to not only augment hackage, but also restrict/constrain the available package set.
I am just a bit confused about this statement?
AlistairBurrowes commentedon Aug 18, 2021
👋 Just a +1 from me a user of stack. I think with this change I would eagerly switch back to cabal and I suspect many other stack users would to. I think cabal getting more users is good for cabal.
As an aside, in the long term I think you could even consider discontinuing stack in favor of cabal with this key addition (and perhaps a few others). Obviously that is a much broader discussion, but I think it would be good for cabal and Haskell more broadly.
vaibhavsagar commentedon Aug 18, 2021
Aren't these already supported by downloading the correct
cabal.configfrom Stackage?gbaz commentedon Aug 18, 2021
@parsonsmatt can you expand on how this might work? Like you could have a set of resolvers and CI would check against all of them? I imagine this would be maybe a twofold thing. First, make it easy to pass different resolvers on the command line, and second then teach the CI script to run a project multiple times, one with each setting...
I was just looking at a related ticket (#7367) on generalizing freeze file handling to decouple it as directly from
cabal.projectfiles -- I imagine some similar considerations would have to be taken into consideration in terms of where/how the configuration could be set in this proposal.Kleidukos commentedon Aug 18, 2021
As an industrial user of both stack and cabal, I am in full support of being compatible with Stackage. I am truly happy to see that the new Cabal team is motivated and dynamic on the subject of improving the tooling.
hasufell commentedon Aug 18, 2021
Obviously, I support the idea of remote freeze files.
However, I'm mildly against adding direct syntax support for stack resolvers, whether it's
*.cabalorcabal.project. So far this idea doesn't seem to be too strong here, but I'll list the arguments ahead of time:cabal.project.freezealready. Ultimately, we could simply collaborate with stackage maintainers here to make this better as a service.One problem with remote freeze files is the lack of support for pinning revisions. This can currently only be done implicitly via hackage-index, which is not the same as stackage snapshots. This needs discussion.
michaelpj commentedon Aug 18, 2021
An issue if we want a stack-like workflow is that the semantics of freeze files don't seem to be the same as that of resolvers. The most important difference is that in Stack user settings (e.g.
extra-deps) override the resolver, whereas with a Cabal freeze file they conflict.This is pretty important since essentially every project I've ever worked on with a Stack configuration has needed to tweak the resolver like this in some way.
So we might need some extensions to freeze files or the solver to make this usable.
Having tried this, yes that gets you a file you can use as a freeze file, but it's not really usable for the reasons above.
Kleidukos commentedon Aug 18, 2021
The cabal.config files provided by Stackage are not immune to revisions, which is a problem if we want to use them directly
(see https://www.stackage.org/lts-18.5/cabal.config for example).
We can have an integration of stack2cabal under the hood by
cabal-install, I don't see what is the problem here.hasufell commentedon Aug 18, 2021
@Kleidukos
Yes, I pointed that out above. This needs to be discussed.
Many:
20 remaining items
hasufell commentedon Aug 19, 2021
I think there are two ideas about this, one being new syntax in the freeze file for the constraints, such as
foo ~== 1.0(@michaelpj) . The other, from what I understood in @dcoutts' RFC, is that constraint sets wouldn't have special syntax. Instead, the interpretation/interaction of those is up to the tool (that would e.g. provide an algebra on how to combine them). That also keeps things clean, since a set is self-contained and doesn't contain special rules about specific constraints.I believe interpreting sets on the tooling side is a good idea and allows us to gradually implement these things. The next step could be naming sets, fetching multiple freeze files and then have an algebra on how to combine them in
cabal.project.I may also point out that there's a subtle difference between freeze file and constraint set: freeze files can contain everything
cabal.projectcan, pin index state etc etc. A constraint set would just be constraints.dcoutts commentedon Aug 19, 2021
@hasufell indeed I think it's very similar in concept.
ivanperez-keera commentedon Aug 19, 2021
At a high level, I would just say:
Mikolaj commentedon Aug 19, 2021
I don't think making it the default in a compatibility-breaking way is even on the table. For making it the default in what
cabal initproduces, I agree we'd need some time to stabilize the feature, collect feedback, build awareness. For completely optional integration (in particular, incurring no performance regression), I don't think we need any particular delays, though we may have them anyway due to cabal having plenty of bugs, half-implemented features and other urgent tasks keeping contributors occupied.emilypi commentedon Aug 26, 2021
It sounds like there's overwhelming support for this, and I'm happy to include it for the Cabal 3.8 release!
gbaz commentedon Aug 26, 2021
I'd like to sketch a slightly modified version of @hasufell 's proposal, based on some irc chat:
And that's it!
For now we leave .freeze and .local semantics as is -- we could add more configuration in a future release. This means that we can therefore omit the
ignore-if-absentthing for now.This only leaves the question of the combining stuff. But if we consider the use-cases, there's only two that matter in my opinion. First: some default package set that we may want to override (i.e. bumping the bytestring version). Second: pinning down a specific version for freeze purposes. If we think in terms of "and" and "or" the first scenario is "union with or" and the second is "union with and". But both cases are covered by simply having the semantics be "always override." For version constraints, each declaration of new constraints would simply replace the old constraints. For flag constraints, we would not override on a per-package basis, but a per-flag basis. I.e. "-foo" would override "+foo" but "-bar" wouldn't clear out any existing "foo" flags.
This should avoid needing to introduce any explicit package algebra for now, or modifying existing constraint syntax. As far as I know it should not harm any existing behavior, and it gives us a default that is easy to understand and which obeys least surprise.
(edit: the one use case this doesn't cover is "negative collections" of blacklisted versions, etc. that said, the preferences and deprecation mechanism on hackage give us at least a single "global" way of warning off certain packages. I think the negative collections idea is nice, but should be considered as a future extension of this work, since they're not the main initial use case we want to target, and it simplifies things considerably to just not worry about all the "algebra" questions of combining for a first cut)
Thoughts?
michaelpj commentedon Aug 27, 2021
I'm a bit unclear on what the behaviour of overriding sets of constraints is supposed to be. Let me list out some options that I see and see if that clarifies things.
constraintsstanzaThat is:
would give us just
foo == 2.0. I'm pretty sure nobody meant this but just including it for completeness.That is:
would give us
foo == 2.0, bar == 1.0, which seems good.But what about this case? (ref: "adding inequality to existing equality")
If this gives us just
foo >= 1.0, we could pickfoo-2.0in this scenario. I think this is less nice than gettingfoo >= 1.0, foo == 1.0and being forced to pickfoo-1.0.The general case here is where the "overriding" constraints for a package
pdo not conflict with the earlier constraints for that package. Then it seems nicer to keep them.However, I'm not sure it's easy to actually specify what this behaviour should be, so maybe it's not worth it. We could try and say something like:
or something, but quite possibly this has ugly corner cases and might be hard to compute.
Anyway, I think the "adding inequality to existing equality" usecase is worth considering, but it's probably fairly niche and shouldn't dictate the design.
Doesn't it? I guess it depends what you want. I think the design you proposed (assuming we're overriding per-package) would let you give a set of blacklisted packages, but allow a user to override them, i.e.
would give us
foo == 1.0, which seems fine. What it wouldn't let you do is blacklist versions in a way that the user can't override, but that seems right to me.gbaz commentedon Aug 27, 2021
I meant 2 -- full overrides per package, since I think the behavior will be clearest and easiest to implement.
As for blacklists, yes. this will give us what you describe -- overridable ones. I suppose that's ok, although I worry a bit about the UX experience.
phadej commentedon Aug 30, 2021
FWIW:
However https://www.stackage.org/lts-18.8/package/nix-paths-1.0.1 is in Stackage LTS 18.8 (GHC-8.10.6)
I was really surprised to find this, but it makes a point: Stackage should be test-build with
cabal-installtoo, if stackage support is integrated into cabal-install.Somewhat related: Stackage snapshots record (also automatic) flag selections, which breaks across different environments (operating systems). I actually have no idea in which extend Stackage snapshots are built on Windows (and MacOS), and how these differences are expressed.
Anyway, the collection grammar should be expressive enough to allow flipping flags in different (staticly known) environments. (or people have to rely on automatic flags being selected correctly, which should be the case if the branches are mutually exclusive, which is the design guideline but not enforced - paranoid people may still want to pin the automatic flags too).
gbaz commentedon Jan 5, 2022
related: #7783
This covers the ability to include freeze files, other project files, etc in project files. Which leaves only the constraints stuff, which really should be a distinct PR.
AlistairB commentedon May 7, 2022
Hi, is this feature still being planned for 3.8? I'm stack user who is eager to switch to cabal if this support is in place.
gbaz commentedon May 8, 2022
In 3.8 we will have conditionals and includes (including remote) in cabal project files. So it will cover many use cases. However, we will not yet have the ability to override constraints in included files. So if you include a given lts, you will not be able to bump the version of anything in the lts, outside of downloading and modifying its freeze file, then depending on the modified freeze file.
There's a design for changing the semantics of multiple constraints on the same package to allow later constraints to override earlier ones, but it will not make it in time for 3.8.
ulysses4ever commentedon Jul 18, 2022
@gbaz you write:
Is there a ticket describing this feature request and / or design you mentioned. Should the current ticket be closed as completed in its basic form? (The ticket title reads: “support for LTS” not “support for overriding constraints from LTS”]