I am trying to create a type augmentation method for an F# tuple. This code compiles just fine:
type System.Tuple<'a, 'b> with
member this.ToParameter name =
match this with
| this -> sprintf "%s=%O,%O" name (this.Item1, this.Item2)
However, when I try to invoke this method:
printfn "%s" (("cat", 2).ToParameter("test"))
I get an error saying "This field, constructor or member 'ToParameter' is not defined." In the interpreter, the following expressions report their type as being some form of System.Tuple'2:
typedefof<'a * 'b>.FullName
(1, 2).GetType().FullName
In the Visual Studio, if I hover over the expression:
let a = 1, 2
It reports a type of int * int. When I try to augment this type, or it's generic equivalent, 'a * 'b, I get an error.
Is it possible to create a generic augmentation for the F# tuple?