-
Notifications
You must be signed in to change notification settings - Fork 8
Pattern matching
-
Value
Just "Dawn"and pattern(Just variable)Yes:
variableis 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 becauseJustis different thanOK. -
Value
Just "Dawn"and patternNothingNo: something with two elements can't match something with one.
-
Value
Just "Dawn"and patternOk variableNo:
Justis different thanOk -
Value
Just (Just "Dawn")and patternJust (Just variable)Yes: Nested structures can be matched.
variableis bound to"Dawn". -
Value
Just (Just "Dawn")and patternJust variableYes: and
variableis bound toJust "Dawn". Variables can match substructures.