You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Gathering here the proposal to extend the pattern-matching language
(for rational patterns, see #43) as well as interesting examples using
the introduced features.
intersection patterns p@q matches if p matches and q matches (right-to-left shadowing)
union patterns p+q matches if either p matches or if it does not and q matches (usually using | but here it would clash with Cell...)
Yes to intersection! Yes to negation! Note that !_ becomes the grumpy pattern.
Union patterns are a tad scarier. It's fun to imagine the type system for them, or even how to scope them. Perhaps p+q binds only those pattern variables which occur in both?
I wonder whether intersection should be & rather than @, or indeed whether /\ and \/ might have some part to play.
Gathering here the proposal to extend the pattern-matching language
(for rational patterns, see #43) as well as interesting examples using
the introduced features.
intersection patterns
p@q
matches ifp
matches andq
matches (right-to-left shadowing)union patterns
p+q
matches if eitherp
matches or if it does not andq
matches (usually using|
but here it would clash withCell
...)This example is a bit artificial and requires the function to be uncurried... :/
!p
matches ifp
does not match (no bindings)The text was updated successfully, but these errors were encountered: