It does, but you should annotate the following:
type Thing<'a when 'a:comparison> =
| Pair of ('a*'a)
with
member m.InOrder() =
match m with
| Pair (a,b) when a<=b -> true
| _ -> false
member m.Equal() =
match m with
| Pair (a,b) when a=b -> true
| _ -> false
Pair(1,2).InOrder()
Pair(3,2).InOrder()
Pair(42,42).Equal()
Try replacing Thing<'a when 'a:comparison>with Thing<'a when 'a:equality>to see how the method works InOrder(), but Equal()it still works. Replace Thing<'a when 'a:comparison>with Thing<'a>and both methods will not work.
source
share