If I have an record such as:
type MyDate =
{ Year : int
Month : int
Day : int }
I know that F#'s structural comparison will ensure that when a list is sorted it will maintain a consistent order.
My question is whether I can rely on it to do the comparison in a specific way, and what that way is?
For example with the MyDate
record above: if it compares each field in the order they were declared then I could assume the following:
{ Year: 2010; Month: 9: Day: 8 } > { Year: 2009; Month: 10; Day: 20 }
I've struggled to find the documentation that describes how the structure equality for Record types work. I can see from the Fsharp.Core tests how tuple comparison works: https://github.com/fsharp/fsharp/blob/cb6cb5c410f537c81cf26825657ef3bb29a7e952/tests/fsharp/core/attributes/test.fsx#L737, but I can't seem to find a similar test for Record types.