Patterns are used to select case alternatives and are matched against values. For structured types, pattern matching is carried out from left to right, and components may also be nested patterns. A match is said either to succeed or fail as described below for the various pattern forms:
A match against the wildcard pattern always succeeds.
The literal must be one of the following types:
Int, Char, String
The value is matched both by data type and equality.
The value is bound to the name of the variable locally within the alternative.
The value is matched both by data type and equivalence to the data constructor.
The value is first matched both by data type and equivalence to the data constructor. Secondly, each component of the data value is matched against the corresponding component pattern.
Last update: 11 October, 2005