F# Generic constraint to have one generic type inherit from another
问题 In C# it is straightforward to define a generic class when one generic parameter inherits from another, e.g.: public class MyClass<TClass, TInterface> where TClass : class, TInterface { } This is used to "force" the class TClass to implement the interface TInterface . I want to do the same in F# and surprisingly it does not seem to work. For example, the following code: type Startup<'S, 'I when 'I : not struct and 'S : not struct and 'S :> 'I>() = member _.x = 0 results in FS0663 - This type