-
Notifications
You must be signed in to change notification settings - Fork 685
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
Enhance --allow-{newer,older}
syntax
#4575
Conversation
c56cd8b
to
e8fa060
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM modulo some comments.
data RelaxDepScope = RelaxDepScopeAny | ||
-- ^ Apply relaxation in any package | ||
| RelaxDepScopePackage !PackageName | ||
-- ^ Apply relexation to in all versions of a package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: relexation.
removeBound RelaxLower RelaxDepModNone = removeLowerBound | ||
removeBound RelaxUpper RelaxDepModNone = removeUpperBound | ||
removeBound relKind RelaxDepModCaret = | ||
foldVersionRange' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be a good idea for the future to add a variant of foldVersionRange
that takes a record, so that in the case where most transformations are identity, client code would be more compact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the very same thought when I implemented that function! :-)
normalP = RelaxedDep `fmap` parse | ||
-- "greedy" choices | ||
scopeP = (pure RelaxDepScopeAny <* Parse.char '*' <* Parse.char ':') | ||
Parse.<++ (pure RelaxDepScopeAny <* Parse.string "all:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit confusing that the constructor which corresponds to all
is called RelaxDepScopeAny
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll rename
Dependency pkgName (vrtrans verRange) | ||
relaxPackageDeps vrtrans (RelaxDepsSome allowNewerDeps') gpd = | ||
relaxAll (Dependency pkgName verRange) = | ||
Dependency pkgName (removeBound relKind RelaxDepModNone verRange) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should allow something like --allow-newer=^all
to relax only caret dependencies everywhere. Probably not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, the ^
thing conflicts with zsh
shell expansion too:
$ echo ^all
appveyor-retry.cmd appveyor.yml AUTHORS Cabal cabal-install cabal.project cabal.project.travis
cabal-tests.log cabal-testsuite default.nix dist dist-newstyle ghc-packages id_rsa_cabal_website.aes256.enc LICENSE README.md stack.yaml TAGS travis travis-bootstrap.sh travis-common.sh travis-deploy.sh
travis-install.sh travis-meta.sh travis-script.sh travis-solver-debug-flags.sh travis-stack.sh update-cabal-files.sh
$ echo foo:^all
zsh: no matches found: foo:^all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I do plan to support --allow-newer=all
, --allow-newer=^all
, --allow-newer=foo:^all
, etc. via a future PR. That's a perfectly valid use-case when I want to quickly see if there's overly constraining upper bounds in a specific package.
I'm not sure what to do about zsh
getting in the way... which unquoted syntax does it not try to interpret? ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep using ^
, it's not a very common operation, and zsh
users can use quotes.
This extends the capabilities of `--allow-{newer,older}` to allow for more fine-grained scoping to control more precisely which packages and constraints a relaxation is applied to. See updated documentation for more details.
e8fa060
to
a0d8035
Compare
--allow-{newer,older}
syntax--allow-{newer,older}
syntax
This builds on top of a0d8035 (haskell#4575) and extends the syntax to support the token `all` or `*` to serve as wild-card for the relaxation subject, i.e. the following non-exhaustive list of forms is made possible (NB: the package name `all` is reserved on Hackage): allow-newer: somepkg:* allow-newer: somepkg:all allow-newer: somepkg:^* allow-newer: somepkg:^all allow-newer: all:^all allow-newer: *:^all allow-newer: *:^* allow-newer: *:* allow-newer: all:all Refer to the user's guide for details
This builds on top of a0d8035 (haskell#4575) and extends the syntax to support the token `all` or `*` to serve as wild-card for the relaxation subject, i.e. the following non-exhaustive list of forms is made possible (NB: the package name `all` is reserved on Hackage): allow-newer: somepkg:* allow-newer: somepkg:all allow-newer: somepkg:^* allow-newer: somepkg:^all allow-newer: all:^all allow-newer: *:^all allow-newer: *:^* allow-newer: *:* allow-newer: all:all Refer to the user's guide for details
This builds on top of a0d8035 (haskell#4575) and extends the syntax to support the token `all` or `*` to serve as wild-card for the relaxation subject, i.e. the following non-exhaustive list of forms is made possible (NB: the package name `all` is reserved on Hackage): allow-newer: somepkg:* allow-newer: somepkg:all allow-newer: somepkg:^* allow-newer: somepkg:^all allow-newer: all:^all allow-newer: *:^all allow-newer: *:^* allow-newer: *:* allow-newer: all:all Refer to the user's guide for details
This builds on top of a0d8035 (haskell#4575) and extends the syntax to support the token `all` or `*` to serve as wild-card for the relaxation subject, i.e. the following non-exhaustive list of forms is made possible (NB: the package name `all` is reserved on Hackage): allow-newer: somepkg:* allow-newer: somepkg:all allow-newer: somepkg:^* allow-newer: somepkg:^all allow-newer: all:^all allow-newer: *:^all allow-newer: *:^* allow-newer: *:* allow-newer: all:all Refer to the user's guide for details
This extends the capabilities of
--allow-{newer,older}
to allow for morefine-grained scoping to control more precisely which packages and constraints
a relaxation is applied to. See updated documentation for more details.