I discussed this already on Twitter. Basic idea: resolver turns out to have not been a great name. That field is used for specifying a snapshot. Let's just call a spade a spade.
Implementation: in both snapshots and stack.yaml files, instead of looking for just resolver, we'll look for both resolver and snapshot. If both are present: it's an error. If one is present, use it. If neither are present, follow through with current behavior for when there's no resolver set.
Also: update stack new templates to prefer snapshot.
Does stack have any philosophy regarding deprecation? Should support for resolver eventually be removed?
We don't have an official policy. In the past, we've:
Hi, guys!
I'm a new at Haskell, but already appreciate Stack a lot
I want to help you with this task
Is it free to take?
Is it a good place to start?
Yes to both questions! The best place to start would be to grep the src directory for the string "resolver". The most important affected module is Stack.Types.Config.
Guys, I'm sorry for the delay
For the last two weeks I hadn't had consistent working time due to personal circumstances
I still want to finish this issue, but I need more time, week or two
No worries, thanks for the update.
@snoyberg can you tell me if I'm thinking in the right direction?
I want to add snapshot support into stack.yaml
To achieve it I want to amend a function parseProjectAndConfigMonoid (because it contains "resolver"):
https://github.com/commercialhaskell/stack/blob/cf9b94d1899ec1fc487e4dccda3fee5b75254a1c/src/Stack/Types/Config.hs#L1452
My plan is:
describe "parseProjectAndConfigMonoid"it "parses snapshot using 'resolver'"it "parses snapshot using 'snapshot'"it "throws if both 'resolver' and 'snapshot' are present"For now I'm thinking of how to write the tests:
I want to create a temp predefined stack.yaml and load it with parseProjectAndConfigMonoid
It will give me Project object from which I can get projectResolver :: SnapshotLocation
After that I will check if projectResolver is equal to a correct value
If that is a correct line of thought then I have a question:
My stack.yaml is
resolver: lts-2.10
packages: ['.']
How can I do something like
projectResolver `shouldBe` "lts-2.10"
in a test?
SnapshotLocation and String types are incomparable
Overall that sounds right. I'm not quite sure what "temp predefined stack.yaml" means.
For the unit test, you're going to have to construct a SnapshotLocation value. You can use the ltsSnapshotLocation and nightlySnapshotLocation functions from pantry for LTS and nightly snapshots, and the SLCompiler data constructor for ghc-8.4.3 style snapshots.
I'm not quite sure what "temp predefined stack.yaml" means.
I was trying to say that I will copy workflow of loadConfig tests:
inTempDirFor the unit test, you're going to have to construct a SnapshotLocation value. You can use the ltsSnapshotLocation and nightlySnapshotLocation functions from pantry for LTS and nightly snapshots, and the SLCompiler data constructor for ghc-8.4.3 style snapshots.
Thx for your help, it was useful!
Closed by #4341