-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack should be more clear about packages vs. dependencies #1217
Comments
How about having |
@mgsloan I've spent a good 5 minutes puzzling over what you mean, could you write some strawman yaml to demonstrate what you have in mind? |
@bitemyapp Sorry for the confusion, I was being overly terse. What I mean is that the Taking an example from https://github.com/commercialhaskell/stack/blob/master/doc/yaml_configuration.md#packages : packages:
- local-package
- location: vendor/binary
extra-dep: true
- location:
git: [email protected]:yesodweb/wai
commit: 2f8a8e1b771829f4a8a77c0111352ce45a14c30f
subdirs:
- auto-update
- wai Would instead be written packages:
- local-package
- location:
git: [email protected]:yesodweb/wai
commit: 2f8a8e1b771829f4a8a77c0111352ce45a14c30f
subdirs:
- auto-update
- wai
extra-deps:
- location: vendor/binary This does not solve the issue of the user not understanding deps vs local packages, but I think it's much cleaner. What I was trying to say with my second sentence is that you will be able to use the same syntax in packages and extra-deps. However, extra-deps will need to have strings parsed as a package + version, whereas packages have string parsed as a directory. |
Perhaps trying to avoid syntactic overlap was part of the motivation for this? I'm planning to make a video tutorial for Slack with my coauthor soon, so perhaps at least that could help. It seems like it might be more clear, but I'm not convinced the change would be worth the breakage. I'll stew on it. Please pipe up if you have any ideas. |
To soften the breakage, we can certainly have a deprecation of a few major versions. |
It might seem petty, but perhaps projects rather than packages would make it more clear? I don't think most programmers are accustomed to thinking of packages as anything but dependencies. projects:
- local-project
- location:
git: [email protected]:yesodweb/wai
commit: 2f8a8e1b771829f4a8a77c0111352ce45a14c30f
subdirs:
- auto-update
- wai
dependencies:
- location: vendor/binary |
I'm really sorry for interrupting, but as another confused user, what is the difference between those? I have no idea what this means:
|
@bitemyapp That does look nice! I'm not sure if a name change is worth it, though, maybe if the new names were absolutely perfect :) . These names have the following issues:
@MaiaVictor Hmm, yeah, the documentation could use more clarity on this point. The difference is that packages are directly part of your project. All the commands that accept TARGETs are looking for names of local packages ( It also affects how build options are applied. The default behavior of ghc-options recently changed to only apply to your local packages, but with the ability to also apply them to extra-deps / snapshot packages. Some aspects of this are still in flux: #849 . It would definitely be good to write down all the distinctions which are based on whether a package is local / in the extra deps / in the snapshot. This might be informative for design as well, to ensure things behave as consistently as possible. |
Related: #1265 (Unify extra-deps and extensible snapshots) |
FWIW, I myself experience mental churn every time I hit the word "extra-deps". It does not mean what I initially think it means. Maybe it's because "extra" has the connotation of "inessential"? What about "other-deps" or "additional-deps" or "additional-dependencies"? Mmm "other-deps" is just as bad, so strike that one. :) I agree with @borsboom that "packages" is the right word: One cabal file for one package. Multiple packages per project. One stack.yaml per project. But I also agree that it's a rather fine distinction. |
I realize it may be convenient, but including two different kinds of things under the header of "packages", where
extra-dep: true
flips the switch from one default to the other is possibly counter-productive from a UX point of view. I just helped another Stack user who is quite comfortable with Haskell and Cabal get unstuck because theirstack ghci
was broken. It was broken because they had intended to add local/git repos as additional dependencies, but didn't know they neededextra-dep: true
to make them not be primary targets of the Stack build environment.The documentation does touch on this, but doesn't exactly come right out and say it, and honestly, I think getting people to read the docs before diving in is going to be a bit hard as Stack is easy enough to use that they won't really ever need to pause until they run into a problem.
I think a more lasting solution is having separate top-level stanzas for build targets and dependencies coming from a filepath or git repository. The overlap of attributes for these is possibly galling, but you could console yourself with the idea that this is a sum-of-products representation :)
Another issue is the word packages itself. This is sort of a "bring your own preconceptions" word where to some it means "build target" and others it means "dependency you install". I think this is intentional in order to make it a catch-all, but doesn't help with the clarity issue here.
The text was updated successfully, but these errors were encountered: