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

Functor identity not === #46

Closed
marcusradell opened this issue Jun 9, 2016 · 1 comment
Closed

Functor identity not === #46

marcusradell opened this issue Jun 9, 2016 · 1 comment

Comments

@marcusradell
Copy link
Contributor

const before = [1,2,3]
const after = before.map(x => x)
before === after // Returns false
for(let i = 0; i < before.length; i++) {
  before[i] === after[i] // Returns true
}
before.length === after.length // Returns true

First equals-check is for the reference, and after is a shallow copy of before. Easiest way to explain might be to write Assert.deepEqual(before, after) and define Assert.deepEqual somewhere so the code still looks minimal.

@jethrolarson
Copy link
Collaborator

We could alternatively use ≍ or we could define setoid and use that equals as the way to evaluate equivalence.

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