commercialhaskell / commercialhaskell/stack

stack install package --save to add a dependency to the cabal file

Open
#1,933 18 comments 88 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

It would be nice to have a way for stack to automatically add a package dependency to the cabal file using version bounds (in accordance to some accepted package versioning policy) which accept the current version of the package in the snapshot being used.

NPM provides such a functionality with `npm install --save ` which adds the dependency to the local package.json. So one possible command could be `stack install --save `.

For example, if I want to use the `bound` package, and the current version in the snapshot is `1.0.7`, then running `stack install --save bound` in the local package directory would add `bound >= 1.0 && < 1.1` to the project cabal file (or something else, as long as it's consistent, and admits v1.0.7). The user is free to manually modify the version range in the cabal file later.

If there are multiple sections in the cabal file where the dependency could be added, then perhaps the user can be prompted for each one with an `Add package 'bound >= 1.0 && < 1.1' to the dependency list for this section?`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.