Closed jonasporto closed 7 years ago
Yeah we shouldn't use reference equality to define functor. We could use
the setoid .equals
for structural equality
On Fri, Jul 29, 2016, 3:32 PM Jonas Porto notifications@github.com wrote:
I think that Array map method surprisingly doesn't apply as example of Functor
var a = [1, 2 , 3]; a.map(x => x) === a // false
the same for const b = [1, 2, 3]; b.map(x => x) === b // false
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hemanth/functional-programming-jargon/issues/93, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB-4GP9gDeh_rVzBme-5AmRzQWhFOE6ks5qan-JgaJpZM4JYoV2 .
I'll note that Fantasy Land defines equivalence as structural equality, not referential equality.
I think that Array map method surprisingly doesn't apply as example of Functor
var a = [1, 2 , 3];
a.map(x => x) === a // false
the same for
const b = [1, 2, 3];
b.map(x => x) === b // false