From 0192d2c9d0759895b7492cc00651631eb9abc5b5 Mon Sep 17 00:00:00 2001 From: Carl Haken Date: Sat, 27 Aug 2022 13:17:02 -0700 Subject: [PATCH] Remove 'new' operator when invoking Just * Use of 'new' operator with PureScript data constructors is not best practice * Fixes runtime exceptions with purescript-backend-optimizer. Optimizer outputs data constructor as arrow functions. * https://github.com/aristanetworks/purescript-backend-optimizer --- src/Data/HashMap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Data/HashMap.js b/src/Data/HashMap.js index 65f179e..bfa0f1c 100644 --- a/src/Data/HashMap.js +++ b/src/Data/HashMap.js @@ -16,7 +16,7 @@ MapNode.prototype.lookup = function lookup(Nothing, Just, keyEquals, key, keyHas if ((this.datamap & bit) !== 0) { var i = index(this.datamap, bit); if (keyEquals(key)(this.content[i * 2])) - return new Just(this.content[i * 2 + 1]); + return Just(this.content[i * 2 + 1]); return Nothing; } if ((this.nodemap & bit) !== 0) { @@ -486,7 +486,7 @@ function Collision(keys, values) { Collision.prototype.lookup = function collisionLookup(Nothing, Just, keyEquals, key, keyHash, shift) { for (var i = 0; i < this.keys.length; i++) if (keyEquals(key)(this.keys[i])) - return new Just(this.values[i]); + return Just(this.values[i]); return Nothing; };