diff options
author | Kartik Singhal <kartiksinghal@gmail.com> | 2017-08-08 17:19:21 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-08 17:19:21 -0700 |
commit | add335bd0bc51313dd6c86578c275898b69b6b55 (patch) | |
tree | 7aa878f37ea6e0578d5ded6bd13751eacf4ecb6f /standard-ml.html.markdown | |
parent | 6e7c5c793327f4a63b13e555894597915ca91fda (diff) |
Redundancy is not permitted in pattern matching
Diffstat (limited to 'standard-ml.html.markdown')
-rw-r--r-- | standard-ml.html.markdown | 5 |
1 files changed, 4 insertions, 1 deletions
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 *) |