Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richlander/be1fe5180631fb298460 to your computer and use it in GitHub Desktop.
Save richlander/be1fe5180631fb298460 to your computer and use it in GitHub Desktop.
Implicit quotation of method arguments
type Test =
static member EchoExpression([<ReflectedDefinition(true)>] x : Expr<_>) =
let expression, value = (* decompose AST of x *)
printfn "%s evaluates to %O" expression value
let x, y, z = 42, 89.0, 92.5
Test.EchoExpression(x) // "x evaluates to 42"
Test.EchExpression(Math.Max(y, z)) // "Math.Max(y, z) evaluates to 92.5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment