Patterns

identifier
(but not a data-constant-identifier) a variable, which matches any value. No variable may occur twice in the same pattern. Each free occurrence of the identifier in the expression corresponding to the pattern is bound by this pattern. That is, the identifier is a value-identifier in the expression, referring to the value matched.

data-constant-identifier
matches the named data constant.

data-constructor-identifier pattern
matches a value formed by applying the data constructor to a value matching pattern.

numeric-literal
1, 2, ... are abbreviations for succ(0), succ(succ(0)) etc.

pattern + numeric-literal
The form pattern+ k is an abbreviation for succ applied k times to pattern.

' c'
matches the character constant.

" string"
abbreviation for a list of characters.

[ pattern_ 1, ..., pattern_ n]
equivalent to ` pattern_ 1 :: ... :: pattern_ n :: nil'.

[]
equivalent to `nil'.

pattern_ 1, pattern_ 2
matches a pair of values matching pattern_ 1 and pattern_ 2 respectively.

( pattern)
same as pattern.



Ross Paterson <ross@soi.city.ac.uk>