diff --git a/src/Map.ts b/src/Map.ts index 9091edba8..9b4d6e880 100644 --- a/src/Map.ts +++ b/src/Map.ts @@ -727,7 +727,7 @@ export const getTraversableWithIndex = (O: Ord): TraversableWithIndex2C (b: B) => new Map(m).set(key, b)), + F.map(fm, (m) => (b: B) => m.set(key, b)), f(key, a) ) } diff --git a/src/ReadonlyMap.ts b/src/ReadonlyMap.ts index 9e73bc556..554f2d0a9 100644 --- a/src/ReadonlyMap.ts +++ b/src/ReadonlyMap.ts @@ -914,14 +914,14 @@ export const getTraversableWithIndex = (O: Ord): TraversableWithIndex2C ): ((ta: ReadonlyMap, f: (k: K, a: A) => HKT) => HKT>) => { return (ta: ReadonlyMap, f: (k: K, a: A) => HKT) => { - let fm: HKT> = F.of(empty) + let fm: HKT> = F.of(new Map()) const ks = keysO(ta) const len = ks.length for (let i = 0; i < len; i++) { const key = ks[i] const a = ta.get(key)! fm = F.ap( - F.map(fm, (m) => (b: B) => new Map(m).set(key, b)), + F.map(fm, (m) => (b: B) => m.set(key, b)), f(key, a) ) } diff --git a/test/ReadonlyMap.ts b/test/ReadonlyMap.ts index 1564a6f3e..6feb48f11 100644 --- a/test/ReadonlyMap.ts +++ b/test/ReadonlyMap.ts @@ -950,6 +950,7 @@ describe('ReadonlyMap', () => { ]) ) ) + U.deepStrictEqual(_.empty, new Map()) }) it('wither', async () => {