Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this works as expected
- type Example() =
- member __.F(i) = printfn "%d" i
- let inline f (x : ^a) =
- (^a : (member F : int -> unit) (x, 1))
- (^a : (member F : int -> unit) (x, 2))
- f (Example())
- // this doesn't work
- let inline f (x : ^a when ^a : (member F : int -> unit)) =
- // the compiler knows that there must be member F and its signature
- // so the following should be possible
- x.F(1)
- x.F(2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement