For me it seems that compiler has all information for that point, but I get error message. Why?
let inline getLength< ^a when ^a : (member Length : int ) > (x: ^a) = x.Length
To call a member required by a static constraint, you need to use a more involved syntax:
let inline getLength< ^a when ^a : (member Length : int ) > (x: ^a) =
(^a : (member Length : int) x)
This is a bit ugly - which I think emphasizes the point that static member constraints are not the primary way of achieving things (often, you can use e.g. interfaces or other more usual techniques instead).
Also, if you are interested mainly in mathematical code, then you can just use standard operators and functions (together with a few primitives in LanguagePrimitives
) and you won't have to invoke members explicitly.