mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-22 21:52:31 +03:00
Merge pull request #2821 from k4rtik/patch-1
[standard-ml/en] Redundancy is not permitted in pattern matching
This commit is contained in:
commit
4004e7b35d
@ -352,7 +352,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 *)
|
||||
|
Loading…
Reference in New Issue
Block a user