Skip to content

Implicit snapshots (aka: Unify extra-deps and extensible snapshots) #1265

@borsboom

Description

@borsboom

There's a lot of overlap between extra-deps and extensible snapshots. Both give you a to add some "extra stuff" to a snapshot. The main difference is that extra-deps are installed into <project>/.stack-work and treated as slightly weird local packages, while extensible snapshots will go into ~/.stack/snapshots and are immutable. There's a fair amount of confusion around extra-deps (and packages that have extra-dep: true) , so instead of having two ways to do similar things, they should be unified into a single coherent approach.

Particular issues currently:

  • Most people don't want extra-deps to behave like local packages, especially as regards GHC options
  • extra-deps cannot be shared between projects (or copies of the same project)
  • The current stack.yaml configuration is confusing

Now that snapshots can share packages between them, there's no longer a good reason why extra-deps have to be local to the project. Instead, they could form an implicit extended snapshot.

So here, after discussing with @snoyberg, is my proposal for steps to take:

  1. Ensure that extensible snapshots (Extensible snapshots #863) can support everything required to support extra-deps. That would include:

    • Setting custom ghc-options for packages
    • Getting package source from a remote Git repository or local directory [edit: local directory for extended snapshot would not be a good idea, since contents could change]
  2. Modify stack so that an implicit custom snapshot is created for extra-deps, without changing the existing stack.yaml configuration. The implicit custom snapshot's name would be generated by taking a hash the package source location, name, version, flags, and ghc-options (at least) for each package

  3. Rationalize the stack.yaml configuration. In particular, do away with the extra-deps section. All additions to the custom snapshot will be added using a flag in the packages section (similar to the existing extra-dep flag, but perhaps with a different name like extend-snapshot). The existing configuration would be deprecated but still supported for some time.

    Edit: alternatively, keep a separate section for the extended snapshot (akin to current extra-deps section), but have it accept exactly the same syntax as the packages section (but not accepting local directories). Pro: a bit more clear; Con: more work to switch packages between local and extended snapshot (you have to move stuff around in stack.yaml instead of just toggling a flag).

ping @mgsloan @zudov @bitemyapp

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions