-
Notifications
You must be signed in to change notification settings - Fork 842
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
It should not matter if flags given before command or after #3959
Milestone
Comments
Thank you for the report, I can confirm the bug. |
markus1189
added a commit
to markus1189/stack
that referenced
this issue
Jun 6, 2018
This fixes commercialhaskell#3959. The problem is that the [switch](https://hackage.haskell.org/package/optparse-applicative/docs/Options-Applicative-Builder.html#v:switch) function returns a `Just False` which gets wrapped into `First`. This means that the value is *always* set to either `True` or `False` and the `First` monoid means that during options parsing the order of the flags suddenly matters as described in commercialhaskell#3959, because `First (Just False)` is chosen. The fix is to use the [flag](https://hackage.haskell.org/package/optparse-applicative-0.14.2.0/docs/Options-Applicative-Builder.html#v:flag-39-) function that does not set a default value, so we get a `First Nothing` instead.
markus1189
added a commit
to markus1189/stack
that referenced
this issue
Jun 6, 2018
This fixes commercialhaskell#3959. The problem is that the [switch](https://hackage.haskell.org/package/optparse-applicative/docs/Options-Applicative-Builder.html#v:switch) function returns a `Just False` which gets wrapped into `First`. This means that the value is *always* set to either `True` or `False` and the `First` monoid means that during options parsing the order of the flags suddenly matters as described in commercialhaskell#3959, because `First (Just False)` is chosen when `mappend`ing with `First (Just True)`. The fix is to use the [flag](https://hackage.haskell.org/package/optparse-applicative-0.14.2.0/docs/Options-Applicative-Builder.html#v:flag-39-) function that does not set a default value, so we get a `First Nothing` instead.
2 tasks
markus1189
added a commit
to markus1189/stack
that referenced
this issue
Jun 6, 2018
This fixes commercialhaskell#3959. The problem is that the [switch](https://hackage.haskell.org/package/optparse-applicative/docs/Options-Applicative-Builder.html#v:switch) function returns a `Just False` which gets wrapped into `First`. This means that the value is *always* set to either `True` or `False` and the `First` monoid means that during options parsing the order of the flags suddenly matters as described in commercialhaskell#3959, because `First (Just False)` is chosen when `mappend`ing with `First (Just True)`. The fix is to use the [flag](https://hackage.haskell.org/package/optparse-applicative-0.14.2.0/docs/Options-Applicative-Builder.html#v:flag-39-) function that does not set a default value, so we get a `First Nothing` instead.
markus1189
added a commit
to markus1189/stack
that referenced
this issue
Jun 6, 2018
This fixes commercialhaskell#3959. The problem is that the [switch](https://hackage.haskell.org/package/optparse-applicative/docs/Options-Applicative-Builder.html#v:switch) function returns a `Just False` which gets wrapped into `First`. This means that the value is *always* set to either `True` or `False` and the `First` monoid means that during options parsing the order of the flags suddenly matters as described in commercialhaskell#3959, because `First (Just False)` is chosen when `mappend`ing with `First (Just True)`. The fix is to use the [flag](https://hackage.haskell.org/package/optparse-applicative-0.14.2.0/docs/Options-Applicative-Builder.html#v:flag-39-) function that does not set a default value, so we get a `First Nothing` instead.
markus1189
added a commit
to markus1189/stack
that referenced
this issue
Jun 6, 2018
This fixes commercialhaskell#3959. The problem is that the [switch](https://hackage.haskell.org/package/optparse-applicative/docs/Options-Applicative-Builder.html#v:switch) function returns a `Just False` which gets wrapped into `First`. This means that the value is *always* set to either `True` or `False` and the `First` monoid means that during options parsing the order of the flags suddenly matters as described in commercialhaskell#3959, because `First (Just False)` is chosen when `mappend`ing with `First (Just True)`. The fix is to use the [flag](https://hackage.haskell.org/package/optparse-applicative-0.14.2.0/docs/Options-Applicative-Builder.html#v:flag-39-) function that does not set a default value, so we get a `First Nothing` instead.
This should be addressed by #4067. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This happened in a wrapper script, when I'm setting default flags to pass to stack; e.g.
Steps to reproduce
stack --test --no-run-tests build
stack build --test --no-run-tests
Expected
Either both should build tests and not run them or neither should work (since
stack
doesn't take those flags on its own)Actual
The first built and ran tests. The second built but didn't run tests.
In other words,
stack --test build
andstack --test --no-run-tests build
do the same thing.Stack version
Method of installation
From
https://github.com/commercialhaskell/stack/releases/download
The text was updated successfully, but these errors were encountered: