A literal pattern matches only the same literal value. It is often used in clausal definitions of functions.
When a literal pattern is matched against a type
T
,
the type of the literal value must be a subtype of the type
T
.
The match produces an empty typing context, since it binds no variables.
{- Defining logical implication by cases -} def implies(true, true) = true def implies(true, false) = false def implies(false, true) = true def implies(false, false) = true implies(false, false) {- OUTPUT: true -}
Related Reference Topics
Related Tutorial Sections