'Warning 8: this pattern-matching is not exhaustive. Here is an example of a case that is not matched [closed]

Why Leaf doesn't match in this part?

99 | ......match t with
100 |       | Node (Leaf, _, r) -> r
101 |       | Node (l, _, Leaf) -> l
102 |       | Node (l, _, r) ->
103 |         let newy = max l in
104 |         Node (remove newy l,newy, r)
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
Leaf

How to make it work?



Solution 1:[1]

Your match has three alternatives that all start with Node. I don't think there's much question why there's no match for Leaf. If t is Leaf, it won't match any of the three patterns.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeffrey Scofield