Closed damiengarbarino closed 5 years ago
@damiengarbarino this is language issue -> JavaScript I mean. That is why we have added .equals()
method everywhere:
const some1A = Some(1)
const some1B = Some(1)
const some2 = Some(2)
const noneA = None()
const noneB = Some(0).filter(Boolean)
some1A === some1A // true
some1A === some1B // false
some1A.equals(some1B) // true
noneA === noneB // false
noneA.equals(noneB) // true
of course we can create const None
which will be used everywhere, but that still doesn't fix equality for Some values :/
Thanks for your quick answer.
As a matter of fact, the Some(1) === Some(1) cannot be addressed unless storing all instances and we clearly do not want that...
The const None
could be at least one step closer to a real functional language but I understand your point...
Regards,
Damien
Hello,
First of all, thanks for this library that helps us a lot everyday!
I use Maybe in my app state management and I noticed some changes when I assigned to Maybe.None() a property that in fact already contained Maybe.None().
In short:
Of course I test against None before assigning but it feels awkward.
So I tested on Scala and Elm and in both two None are strictly equal.
So it would be great if this could be addressed.
Regard,
Damien