Generics with interfaces in F#
问题 In C# one can state that a generic parameter must implement a certain interface like so: public class Something<T> where T : IComparable { ... } How does one specify this in F#? 回答1: Generic constraints use "when" in F#: type Foo<'a when 'a :> IComparable> = member x.Bla = 0 来源: https://stackoverflow.com/questions/770143/generics-with-interfaces-in-f