The #
is syntactic sugar for a subtype constraint, ie. comp2
is equivalent to:
let comp2<'T, 'U when 'U :> 'T> (x:'T) (y:'U) = doCompare x (y :> 'T)
Unfortunately, the 'U :> 'T
part is not supported by the type system (you cannot constrain a type to be a subtype of a type variable), so this is not possible.