I don't really think you can do it currently.
I tried the implicit casting trick:
class MyFun
{
public Invoke(_ : string) : int
{
42
}
public static @:(fn : MyFun) : string -> int
{
| null => null
| _ => fn.Invoke
}
}
But it failed: "the value called (mf) has non-functional type
Program.MyFun".
Probably we could resolve this by changing type inference engine a
little. But at the time you are just stuck with using indexers (a[x])
or looking for another solution.