-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Extend Patterns #2150
Comments
I think the type level I've no idea if
It makes no sense to use I agree I agree pattern guards sound useful in |
Sorry but I don't quite understand what you are talking about in your first paragraph. However, the reason I proposed Your code example doesn't make much sense since it looks like I would prefer |
If you write
|
I see, so you like 3 and maybe 4. I am convinced since patterns are not a variable type so there is not much usefulness for doing intersection |
This is the initial issue to reopen a few of the items from #99, not all but the ones that would be the most useful.
!
something that will never match anything.&
operator to be used for pattern set intersections:1..5 & 3..8
is the range3..5
. If the patterns do not have any intersection then you get the!
pattern.pat | pat -> pat
no matter the location. This basically means that the|
operator is used with patterns as a pattern set union operator. The requirement is that the patterns must extend over the same type just like in match statements currently.let
bindings:let ((a, _) if a > 5) | (_, a) = (e, f);
would definea
as the value ofe
ife > 5
, and otherwise binda
to the value off
.The text was updated successfully, but these errors were encountered: