Syntax for covariance general parameters when translating C # to F #

I convert the old C # code to our F # project, and this happens pretty well and smoothly, except that I have an interface type that is defined in C #, both with a type restriction out T, and like TeaDrivenDev indicates that it does covariance types :

public interface IFoo<out T>
    where T: IBar
{
    T Copy();
}

How can this be translated into F #? If at all? (see the change history for my previous attempts in the code, but TeaDrivenDev showed me that they are useless and not related to each other based on a misunderstanding of C # out).

+4
source share

Source: https://habr.com/ru/post/1654637/


All Articles