Advertisement
Guest User

F# Statically Resolved Type Parameters and call syntax

a guest
May 18th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.30 KB | None | 0 0
  1. // this works perfectly
  2. type Example() =
  3.   member this.F(i) = printfn "%d" i
  4.  
  5. let inline f (x : ^a) =
  6.   (^a : (member F : int -> unit) (x, 1))
  7.  
  8. f (Example())
  9.  
  10. // this doesn't but should (function signatures are identical)
  11. let inline f (x : ^a when ^a : (member F : int -> unit)) =
  12.   x.F(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement