Итак, у меня есть этот кусок кода:
let rec minBound s =
match s with
Rect (s,i)-> Rect(s,i)
|Circle (c,r)-> getRectOutCircle (c,r)
|Union(l,r)->
let Rect(sl, il) = (minBound l) in
let Rect(sr, ir) = (minBound r) in
let (xsl,ysl) = sl in
let (xil,yil) = il in
let (xsr,ysr) = sr in
let (xir,yir) = ir in
Rect( ((min xsl xsr), (min ysl ysr)) ,
(( max xil xir), (max yil yir)) )
|Intersection(l,r)->
let Rect(sl, il) = (minBound l) in
let Rect(sr, ir) = (minBound r) in
let (xsl,ysl) = sl in
let (xil,yil) = il in
let (xsr,ysr) = sr in
let (xir,yir) = ir in
Rect( ((min xsl xsr), (min ysl ysr)) ,
(( max xil xir), (max yil yir)) )
|Subtraction(l,r) ->
let Rect(sl, il) = (minBound l) in
let Rect(sr, ir) = (minBound r) in
let (xsl,ysl) = sl in
let (xil,yil) = il in
let (xsr,ysr) = sr in
let (xir,yir) = ir in
Rect( ((min xsl xsr), (min ysl ysr)) ,
(( max xil xir), (max yil yir)) )
;;
Может кто-нибудь объяснить, почему это дает мне следующее предупреждение?
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
(Circle (_, _)|Union (_, _)|Intersection (_, _)|Subtraction (_, _))val minBound : shape -> shape = <fun>
Вот еще некоторая информация, чтобы помочь !!
type point = float*float;;
type shape = Rect of point*point
| Circle of point*float
| Union of shape*shape
| Intersection of shape*shape
| Subtraction of shape*shape
;;