Skip to content
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

Remove Misc.may_map and similar #8692

Merged
merged 3 commits into from May 24, 2019
Merged

Remove Misc.may_map and similar #8692

merged 3 commits into from May 24, 2019

Conversation

lpw25
Copy link
Contributor

@lpw25 lpw25 commented May 23, 2019

Now that we have an Option module in the stdlib we can remove some helper functions from the compiler. I grepped for matches on Some to try to find all the clones of Option.map and Option.iter so hopefully I got them all.

Copy link
Contributor

@trefis trefis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go when CI's green.

Copy link
Member

@gasche gasche left a 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. I think this is fine to merge once the CI agrees.

Most of the changes are obviously readability-preserving -- I would say that the new names are better than the old one. The use of Option.fold instead of value_default required a bit more thinking: from a callsite perspective it replaces a not-very-clear API by another not-very-clear API, because this thing is simply a bit weird. Maybe we should have an Option.for_all function (and Option.exists I guess), which would have made the use-cases clearer.

@lpw25
Copy link
Contributor Author

lpw25 commented May 23, 2019

Maybe we should have an Option.for_all function (and Option.exists I guess), which would have made the use-cases clearer.

Yeah, Option.for_all would make those cases clearer. At least we are now implementing a for_all with a fold which is more obviously correct.

@gasche
Copy link
Member

gasche commented May 23, 2019

check-typo results:

./lambda/translcore.ml:651.81: [long-line] line is over 80 columns
./typing/tast_mapper.ml:215.81: [long-line] line is over 80 columns
./typing/typecore.ml:527.81: [long-line] line is over 80 columns

@lpw25
Copy link
Contributor Author

lpw25 commented May 24, 2019

check-typos fixed and Changes entry added

@gasche gasche merged commit 101cd9e into ocaml:trunk May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants