Parameters and ReturnType types will work fine IFFn is a concrete
type. If Fn is not concrete (passed in as a type parameter), the Parameters
and ReturnType could not be properly inferred.
For example, the following code failed to inferred the type of the variable x
Remarks
The following are note for the implementation.
ParametersandReturnTypetypes will work fine IFFnis a concrete type. IfFnis not concrete (passed in as a type parameter), theParametersandReturnTypecould not be properly inferred.For example, the following code failed to inferred the type of the variable x
Even though we know then signature of
A['a'], we actually does not know the signature ofC['a']. Considered the following type:Bis totally a valid subtype of A, and can even be used with the function k. We can concluded that ReturnType is not concrete enough.Using infer, we can get both parameters type and the return type, as they come in pair.
ParametersandReturnType, on the other hand, are not.