Rob Lyndon
Rob Lyndon

Reputation: 12661

F# Quotation Generating very strange compile error

I am trying to work out why the following line:

let emailQuotation: Expr<LoginView -> string> = <@ fun (v: LoginView) -> v.Email.Text @>

is failing with a compile error, saying "Lookup of object on indeterminate type...". The property ViewModel.Email is a Xamarin Forms Entry, containing a Text property.

What more information does the compiler need, and why is it not able to interpret this expression?

Upvotes: 4

Views: 52

Answers (1)

Rob Lyndon
Rob Lyndon

Reputation: 12661

My solution is ugly. I can do this:

let emailQuotation = <@ fun (v: LoginView) -> let email: Entry = v.Email in email.Text @>

The quotation wasn't able to interpret the type of v.Email. I'm no expert on code quotations, so there may be a way to make the compiler pick up the type in a single expression.

Upvotes: 1

Related Questions