-
Notifications
You must be signed in to change notification settings - Fork 848
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 <package> which adds the dependency to the local package.json. So one possible command could be stack install --save <package>.
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?.