From add335bd0bc51313dd6c86578c275898b69b6b55 Mon Sep 17 00:00:00 2001 From: Kartik Singhal Date: Tue, 8 Aug 2017 17:19:21 -0700 Subject: Redundancy is not permitted in pattern matching --- standard-ml.html.markdown | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/standard-ml.html.markdown b/standard-ml.html.markdown index c9eb2a2e..22086699 100644 --- a/standard-ml.html.markdown +++ b/standard-ml.html.markdown @@ -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 *) -- cgit v1.2.3