Let's have the following function definition:
module Helpers =
[<ReflectedDefinition>]
let dummy (x:int) = x.ToString()
By using the following quotation we get its representation as a lambda expression:
<@ dummy @>;;
val it : Expr<(int -> string)> =
Lambda (x, Call (None, dummy, [x]))
In this previous question it is stated that quotations represent code quoted syntactically, that meaning that we can not get the same expression by wrapping the same function within other function:
let qwrap f = <@ f @>
qwrap dummy;;
val it : Expr<(int -> string)> =
Value (<fun:it@6-3>)
Is it possible to build the former expression (Lambda (x, Call (None, dummy, [x]))) programmatically?. The objective would be to implement a dynamic qwrap for simple functions ('a -> 'b). The resulting expression is going to be analyzed and I'm interested in being able to keep the function and args names as they are written in the original function.