Redundancy is not permitted in pattern matching

This commit is contained in:
Kartik Singhal 2017-08-08 17:19:21 -07:00 committed by GitHub
parent 6e7c5c7933
commit add335bd0b

View File

@ -351,7 +351,10 @@ val _ = print (say(Red) ^ "\n")
fun say Red = "You are red!"
| say Green = "You are green!"
| say Blue = "You are blue!"
| say _ = raise Fail "Unknown color"
(* We did not include the match arm `say _ = raise Fail "Unknown color"`
because after specifying all three colors, the pattern is exhaustive
and redundancy is not permitted in pattern matching *)
(* Here is a binary tree datatype *)