equals

Performs a deep-comparison of two Maybe values for equality. See adt/union/derivations/equality for details.

This feature is experimental!

This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.

Signature

equals(value)
forall S, a:
  (S a).(S a) => Boolean
where S is Setoid

Documentation

Performs a deep-comparison of two Maybe values for equality. See adt/union/derivations/equality for details.

Example:

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

Properties

Source Code

function(value) {
      assertType(adt)(`${this[tagSymbol]}#equals`, value);
      return sameType(this, value) && compositesEqual(this, value, Object.keys(this));
    }
Stability
experimental
Licence
MIT
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • @boris-marinov
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)