Type restrictions and type arguments are two different things. In your example, 'a and 'b are two type arguments, and when 'b :> seq<'b> is a constraint (only).
Now, as you wrote your first example, it looks like the definitions of type arguments have something to do with type restrictions, but this is only in appearance. Pay attention to this (working) code:
type Something<'b, 'a when 'b :> seq<'b>>() = member this.A (a : 'a, b : 'b) = ()
First you define all type arguments. Only after this does type constraints appear, and the constraint still applies to 'b , not 'a - as long as it looks a bit confusing, the constraint expression is not 'a when 'b :> seq<'b> , it's just when 'b :> seq<'b> .
This is actually almost the same as in C #, another .NET language:
public class Something<TA, TB> where TA: someConstraint where TB: someOtherConstraint
Constraints are more visually separated from C #, so people are not inclined to make the mistake you made in F #.
Luaan source share