Override comparison for F# set
- by Mauricio Scheffer
Is there any way to override the comparison function in a F# set?
I don't see any set construction functions that take a IComparer<T> or comparison function:
Set.ofSeq et al don't take a comparison function
FSharpSet(IComparer<T> comparer, SetTree<T> tree) constructor is internal, because
SetTree is internal and
SetTreeModule.ofSeq<a>(IComparer<a> comparer, IEnumerable<a> c) is obviously internal too.
My actual problem is that I have a set of ('a * 'a) and I want a comparison such that for example (1,3) = (3,1).
I know I could wrap this in a type implementing IComparable<T>, but is there any way to avoid this?