Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Allow implementation of generic methods with constraints of the form 'T :> 'U #255
Allow implementation of generic methods with constraints of the form 'T :> 'U 
Submitted by Gusty on 5/14/2014 12:00:00 AM
Currently this is solved as 'a = 'b.
Yes please, would also be immensely helpful for abstracting away asp.net core apis behind a nicer functional api.
@cartermp this is impossible to do today for say the whole DI stack as many methods are of the form
@abelbraaksma Here's the current situation: The constraint solver engine of F# has no ability to represent constraints of this form - constraints "T :> U" are solved to "T = U" immediately.
This doesn't block adding the feature: we could add this form of constraint and delay solving them until U is a nominal type. We would perhaps somehow have to require that the solution for U arrives earlier rather than later (at the worst you could require that it is explicit in an instantiation on each use of the generic thing, the most extreme approach)