-
Notifications
You must be signed in to change notification settings - Fork 103
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
Omit false conds #404
Omit false conds #404
Conversation
ce9ee11
to
cb3c204
Compare
@@ -394,6 +412,8 @@ becomes | |||
else | |||
ghc-options: -O0 | |||
|
|||
**Note:** Conditionals with `condition: false` are omitted from the generated | |||
`.cabal` file. |
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.
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.
It also gives us cleaner .cabal
files, which doesn't hurt.
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.
Seems safe to me!
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.
Looks good to me!
Along the same lines, would it make sense to flatten conditionals where the value is always true?
README.md
Outdated
@@ -35,6 +35,25 @@ at the Singapore Haskell meetup: http://typeful.net/talks/hpack | |||
|
|||
## Documentation | |||
|
|||
### Handling of `Paths_` modules | |||
|
|||
Cabal generates a `Paths_` module fore every package. By default Hpack adds |
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.
Cabal generates a `Paths_` module fore every package. By default Hpack adds | |
Cabal generates a `Paths_` module for every package. By default Hpack adds |
library: | ||
when: | ||
- condition: false | ||
other-modules: Paths_name # substitute name with the package name |
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.
Should we include a note here about how Cabal generates these modules names? I think it replaces hyphens with underscores. I'm not sure if it does anything else.
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.
That's the only thing I'm aware of. Ideally, I would like to link to the Cabal docs on Path_
, however, I couldn't find anything.
@phadej do you know if the Cabal docs cover Paths_
anywhere?
@@ -394,6 +412,8 @@ becomes | |||
else | |||
ghc-options: -O0 | |||
|
|||
**Note:** Conditionals with `condition: false` are omitted from the generated | |||
`.cabal` file. |
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.
Seems safe to me!
String s -> return (Cond $ T.unpack s) | ||
Bool True -> return (Cond "true") | ||
Bool False -> return (Cond "false") | ||
String c -> return (CondExpression $ T.unpack c) |
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 this means someone could avoid this new filtering behavior by explicitly passing a string. Like this:
when:
- condition: 'false'
That's probably fine, and may in fact be desired as a workaround.
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.
Yes, exactly, that's what I thought.
Possibly, however, I'm not going to do this for now. |
@tfausak thanks for the review. I'm going to merge. |
No description provided.