Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equals is not a function error when comparing records #1081

Closed
whitebear-gh opened this issue Jul 18, 2017 · 1 comment
Closed

Equals is not a function error when comparing records #1081

whitebear-gh opened this issue Jul 18, 2017 · 1 comment

Comments

@whitebear-gh
Copy link

Description

Hello, when I'm trying to compare records I get following error:

x.Equals is not a function

The workaround is to use one field to compare but comparing records works in F# itself. Is it possible to have it working in Fable?

Repro code

records |> List.filter (fun r -> r = record2)

@alfonsogarciacaro
Copy link
Member

Hi @whitebear-gh! I tried something like the following but it's working for me:

type R = { foo: string }

let test() =
    let records = [{foo = "foo"}; {foo = "bar"}]
    let record2 = {foo = "foo"}
    let records2 = records |> List.filter (fun r -> r = record2)
    printfn "%A" records2
    List.length records2 |> equal 1

test()

Could you please provide a full repro code (including type definitions, etc) that fails with latest Fable version? Thanks a lot for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants