Skip to content

Commit

Permalink
S.equals_ :: Setoid a => a -> a -> Boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
davidchambers committed Jan 21, 2017
1 parent 10b59c0 commit 818ead2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,12 @@
//. ```
S.equals = def('equals', {}, [a, b, $.Boolean], Z.equals);

//# equals_ :: Setoid a => a -> a -> Boolean
//.
//. Variant of [`equals`](#equals) which requires two arguments of the
//. same type.
S.equals_ = def('equals_', {a: [Z.Setoid]}, [a, a, $.Boolean], Z.equals);

//# concat :: Semigroup a => a -> a -> a
//.
//. Curried version of [`Z.concat`][].
Expand Down
1 change: 1 addition & 0 deletions test/equals.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test('equals', function() {
eq(S.equals.length, 2);
eq(S.equals.toString(), 'equals :: a -> b -> Boolean');

eq(S.equals('foo', 42), false);
eq(S.equals(S.Nothing, S.Nothing), true);
eq(S.equals(S.Just(NaN), S.Just(NaN)), true);
eq(S.equals(S.Just(0), S.Just(-0)), false);
Expand Down
22 changes: 22 additions & 0 deletions test/equals_.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict';

var S = require('..');

var eq = require('./internal/eq');


test('equals_', function() {

eq(typeof S.equals_, 'function');
eq(S.equals_.length, 2);
eq(S.equals_.toString(), 'equals_ :: Setoid a => a -> a -> Boolean');

eq(S.equals_(S.Nothing, S.Nothing), true);
eq(S.equals_(S.Just(NaN), S.Just(NaN)), true);
eq(S.equals_(S.Just(0), S.Just(-0)), false);
eq(S.equals_(S.Left(NaN), S.Left(NaN)), true);
eq(S.equals_(S.Left(0), S.Left(-0)), false);
eq(S.equals_(S.Right(NaN), S.Right(NaN)), true);
eq(S.equals_(S.Right(0), S.Right(-0)), false);

});

0 comments on commit 818ead2

Please sign in to comment.