| MatchCase | |||
| ::= | { MatchRule (, MatchRule)* } | ||
| MatchRule | |||
| ::= | Patterns (when Expression)opt => Expression | ||
| Patterns | |||
| ::= | PatternTuple | ||
| | | Pattern | ||
| PatternTuple | |||
| ::= | ( Pattern (, Pattern)+ ) | ||
| Pattern | |||
| ::= | IsPattern : Type | ||
| | | IsPattern | ||
| IsPattern | |||
| ::= | ValueId is OrPattern | ||
| | | ValueId isnot OrPattern | ||
| | | _ isnot OrPattern | ||
| | | OrPattern | ||
| OrPattern | |||
| ::= | OrPattern (| ConsPattern)+ | ||
| | | ConsPattern | ||
a::_ | _::a_::_the right pattern is covered by the left, so that a will always be bound to the head of the list on a successful match. In such a case, we say that the right pattern is redundant and the compiler should issue an error.
|
| ConsPattern | |||
| ::= | ApplyPattern :: ConsPattern | ||
| | | ApplyPattern | ||
| ApplyPattern | |||
| ::= | Pathopt DataCon PatternTuple | ||
| | | Pathopt DataCon AtomicPattern | ||
| | | AtomicPattern | ||
| AtomicPattern | |||
| ::= | ( Pattern ) | ||
| | | _ | ||
| | | ValueId | ||
| | | DataConstructor | ||
| | | Literal | ||
| | | - NumericLiteral | ||
| RecordPat | |||
| ::= | {| LabeledPat (, LabeledPat)* |} | ||
| LabeledPat | |||
| ::= | Label | ||
| | | Label = Pattern | ||
| | | Label is Pattern | ||
| | | Label isnot Pattern | ||
|
|
|
|
|
|
|
|
|
|
|
|