Using Bounded interface in F#

By kunjee

I am trying to use C# library in F# so it would be very much specific case. I using Servicestack with F#. Now, I am trying to wire up class with interface using method

RegisterAutoWiredAs<T,'TAs>()

signature. Here is ‘T is having constraint that it has to implement ‘TAs. It works fine in C# code.

But F# is having constraint while using interface.

let f:IFoo = Foo() // will give type error
let fi:IFoo – Foo() :> IFoo // will work

Here Foo has implemented IFoo. So, this part is quite different than C# equivalent. Now, above signature is giving type error if I do like this

container.RegisterAutoWiredAs<Foo,IFoo>()

And there is noway to do casting while giving parameter.

Here is line from original project I am trying to run. Everything in this code works other than this part and also sadly other equivalent methods are also failing.

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273