-
Notifications
You must be signed in to change notification settings - Fork 7
Pattern matching
-
Value
Just "Dawn"
and pattern(Just variable)
Yes:
variable
is bound to"Dawn"
. Extra parentheses don't affect the match. -
Value
Just "Dawn"
and patternJust "Brian"
No:
"Dawn"
is different than"Brian"
. -
Value
Just "Dawn"
and patternOk "Brian"
No: both because
"Dawn"
is different than"Brian"
and also becauseJust
is different thanOK
. -
Value
Just "Dawn"
and patternNothing
No: something with two elements can't match something with one.
-
Value
Just "Dawn"
and patternOk variable
No:
Just
is different thanOk
-
Value
Just (Just "Dawn")
and patternJust (Just variable)
Yes: Nested structures can be matched.
variable
is bound to"Dawn"
. -
Value
Just (Just "Dawn")
and patternJust variable
Yes: and
variable
is bound toJust "Dawn"
. Variables can match substructures.