missing name-not-defined error? #96
-
For code below:
Error below occurs:
A little surprised to see the 'true' in line 3 doesn't trigger the error first. Then tried fixing the 4th line as below:
Expecting to see the same "
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 15 replies
-
Do you know how pattern matching works?
Yes, because it's a valid pattern. In fact, you can write
This is also a valid function, which returns I hope this clarifies whatever confuses you. |
Beta Was this translation helpful? Give feedback.
-
This is the expected pattern matching behavior. The |
Beta Was this translation helpful? Give feedback.
-
For your second error:
This error relates to overlapping patterns. |
Beta Was this translation helpful? Give feedback.
-
Thanks for detailed explanations from you both. If "true" match all the cases, maybe also helpful to users that the other clause is "unreachable" because of it. Just tried this similar expression in Arend:
It gives warning below:
|
Beta Was this translation helpful? Give feedback.
Do you know how pattern matching works?
Yes, because it's a valid pattern. In fact, you can write
This is also a valid function, which returns
false
whatever the input is.I hope this clarifies whatever confuses you.