From 4e04aa13318c51f8470139b486a058cd1fcf4dcf Mon Sep 17 00:00:00 2001 From: Steven Langbroek Date: Sun, 10 Feb 2019 21:31:28 +0100 Subject: [PATCH] feat(list): hand element index to traverse fixes #14 --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a67bc75..6975601 100644 --- a/index.js +++ b/index.js @@ -24,8 +24,8 @@ List.prototype.empty = List.empty // traversable List.prototype.traverse = function(point, f) { - return this.reduce((ys, x) => - ys.map(x => y => x.concat([y])).ap(f(x)), point(this.empty)) + return this.reduce((ys, x, i) => + ys.map(x => y => x.concat([y])).ap(f(x, i)), point(this.empty)) } List.prototype.sequence = derived.sequence