-
-
Notifications
You must be signed in to change notification settings - Fork 252
Small mention about disjunctive patterns #70
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
Conversation
Disjunctive patterns are super valuable when you (rightly) don't want to use a wildcard, but have a lot of cases that match to the same thing. I think they should at least be mentioned in the docs even if they may not warrant a whole sub-section.
Ah jeez. I'm sorry about triggering so many builds! |
I refactored the intro to be simpler, and only mentioned the term disjunctive patterns as a brief aside. I also cleaned up the code examples and added a note about the refactoring advantages (mainly that you can have multiple disjunctive pattern sets unlike wildcards). This is getting a bit large. So, it might be reasonable to split it into its own sub-section, but I'll leave that decision to you, of course. |
I like it! Maybe it would make sense to put this content further up in the the "Exhaustiveness Check" Section with a sub header like "Match multiple cases to one expression" or similar? That way it would not get lost in the Tips / Tricks section |
Moved it to its own sub-section. LMK if you'd like any other tweaks. |
Hey @AHBruns. Thanks for the effort; this is indeed valuable to document more explicitly. I'll go ahead and merge it, but I'll rewrite it a bit. |
Done. See my comments at db82e57. Thanks again! |
Disjunctive patterns are super valuable when you (rightly) don't want to use a wildcard, but have a lot of cases that match to the same thing. I think they should at least be mentioned in the docs even if they may not warrant a whole sub-section.
Because of the tiny size of this change, I just went ahead and opened a PR since it took about the same amount of work as opening an issue on the topic. I hope that's okay.