Performs a deep-comparison of two Maybe values for equality. See adt/union/derivations/equality
for details.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
Performs a deep-comparison of two Maybe values for equality. See adt/union/derivations/equality
for details.
const Maybe = require('folktale/maybe');
Maybe.Just(1).equals(Maybe.Just(1));
// ==> true
Maybe.Just(1).equals(Maybe.Nothing());
// ==> false
Maybe.Nothing().equals(Maybe.Nothing());
// ==> true
Maybe.Just(Maybe.Just(1)).equals(Maybe.Just(Maybe.Just(1)));
// ==> true
function(value) {
assertType(adt)(`${this[tagSymbol]}#equals`, value);
return sameType(this, value) && compositesEqual(this, value, Object.keys(this));
}