Repository: gcanti/fp-ts
Pull request #1274 (2020-07-21 13:19:23)

version 2.7.1


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d180917..e4f5c78a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,9 +11,28 @@
 > - [Experimental]
 > - [Deprecation]
 
-**Note**: Gaps between patch versions are faulty/broken releases. **Note**: A feature tagged as Experimental is in a
+**Note**: Gaps between patch versions are faulty/broken releases.
+**Note**: A feature tagged as Experimental is in a
 high state of flux, you're at risk of it changing without notice.
 
+# 2.7.1
+
+- **Bug Fix**
+  - `ReadonlyArray`
+    - fix `FunctorWithIndex` instance name (@gcanti)
+    - fix `Functor` instance name (@gcanti)
+- **Polish**
+  - `Array`
+    - relax `sort` signature (@gcanti)
+    - relax `sortBy` signature (@gcanti)
+  - `Map`
+    - export `mapWithIndex` (@gcanti)
+  - `ReadonlyArray`
+    - relax `sort` signature (@gcanti)
+    - relax `sortBy` signature (@gcanti)
+  - `ReadonlyMap`
+    - export `mapWithIndex` (@gcanti)
+
 # 2.7.0
 
 - **Bug Fix**
diff --git a/docs/modules/Array.ts.md b/docs/modules/Array.ts.md
index ca0ae615..0d4ad42b 100644
--- a/docs/modules/Array.ts.md
+++ b/docs/modules/Array.ts.md
@@ -841,7 +841,7 @@ Sort the elements of an array in increasing order, creating a new array
 **Signature**
 
 ```ts
-export declare const sort: <A>(O: Ord<A>) => (as: A[]) => A[]
+export declare const sort: <B>(O: Ord<B>) => <A extends B>(as: A[]) => A[]
 ```
 
 **Example**
@@ -863,7 +863,7 @@ etc...
 **Signature**
 
 ```ts
-export declare const sortBy: <A>(ords: Ord<A>[]) => (as: A[]) => A[]
+export declare const sortBy: <B>(ords: Ord<B>[]) => <A extends B>(as: A[]) => A[]
 ```
 
 **Example**
diff --git a/docs/modules/Map.ts.md b/docs/modules/Map.ts.md
index e56b6507..ba725df2 100644
--- a/docs/modules/Map.ts.md
+++ b/docs/modules/Map.ts.md
@@ -22,6 +22,8 @@ Added in v2.0.0
   - [partitionMap](#partitionmap)
 - [Functor](#functor)
   - [map](#map)
+- [FunctorWithIndex](#functorwithindex)
+  - [mapWithIndex](#mapwithindex)
 - [combinators](#combinators)
   - [deleteAt](#deleteat)
   - [insertAt](#insertat)
@@ -142,11 +144,23 @@ use the type constructor `F` to represent some computational context.
 **Signature**
 
 ```ts
-export declare const map: <A, B>(f: (a: A) => B) => <E>(fa: Map<E, A>) => Map<E, B>
+export declare const map: <A, B>(f: (a: A) => B) => <K>(fa: Map<K, A>) => Map<K, B>
 ```
 
 Added in v2.0.0
 
+# FunctorWithIndex
+
+## mapWithIndex
+
+**Signature**
+
+```ts
+export declare const mapWithIndex: <K, A, B>(f: (k: K, a: A) => B) => (fa: Map<K, A>) => Map<K, B>
+```
+
+Added in v2.7.1
+
 # combinators
 
 ## deleteAt
diff --git a/docs/modules/ReadonlyArray.ts.md b/docs/modules/ReadonlyArray.ts.md
index 8ef7f126..0fea5e05 100644
--- a/docs/modules/ReadonlyArray.ts.md
+++ b/docs/modules/ReadonlyArray.ts.md
@@ -108,6 +108,7 @@ Added in v2.5.0
   - [Foldable](#foldable-1)
   - [FoldableWithIndex](#foldablewithindex-1)
   - [Functor](#functor-1)
+  - [FunctorWithIndex](#functorwithindex-1)
   - [Monad](#monad-1)
   - [Traversable](#traversable-1)
   - [TraversableWithIndex](#traversablewithindex-1)
@@ -115,7 +116,6 @@ Added in v2.5.0
   - [URI (type alias)](#uri-type-alias)
   - [Unfoldable](#unfoldable-1)
   - [Witherable](#witherable)
-  - [functorArray](#functorarray)
   - [getEq](#geteq)
   - [getMonoid](#getmonoid)
   - [getOrd](#getord)
@@ -841,7 +841,7 @@ Sort the elements of an array in increasing order, creating a new array
 **Signature**
 
 ```ts
-export declare function sort<A>(O: Ord<A>): (as: ReadonlyArray<A>) => ReadonlyArray<A>
+export declare const sort: <B>(O: Ord<B>) => <A extends B>(as: readonly A[]) => readonly A[]
 ```
 
 **Example**
@@ -863,7 +863,7 @@ etc...
 **Signature**
 
 ```ts
-export declare function sortBy<A>(ords: ReadonlyArray<Ord<A>>): (as: ReadonlyArray<A>) => ReadonlyArray<A>
+export declare function sortBy<B>(ords: ReadonlyArray<Ord<B>>): <A extends B>(as: ReadonlyArray<A>) => ReadonlyArray<A>
 ```
 
 **Example**
@@ -1324,7 +1324,17 @@ Added in v2.7.0
 **Signature**
 
 ```ts
-export declare const Functor: FunctorWithIndex1<'ReadonlyArray', number>
+export declare const Functor: Functor1<'ReadonlyArray'>
+```
+
+Added in v2.7.0
+
+## FunctorWithIndex
+
+**Signature**
+
+```ts
+export declare const FunctorWithIndex: FunctorWithIndex1<'ReadonlyArray', number>
 ```
 
 Added in v2.7.0
@@ -1399,16 +1409,6 @@ export declare const Witherable: Witherable1<'ReadonlyArray'>
 
 Added in v2.7.0
 
-## functorArray
-
-**Signature**
-
-```ts
-export declare const functorArray: Functor1<'ReadonlyArray'>
-```
-
-Added in v2.7.0
-
 ## getEq
 
 Derives an `Eq` over the `ReadonlyArray` of a given element type from the `Eq` of that type. The derived `Eq` defines two
diff --git a/docs/modules/ReadonlyMap.ts.md b/docs/modules/ReadonlyMap.ts.md
index c9229501..de76c18f 100644
--- a/docs/modules/ReadonlyMap.ts.md
+++ b/docs/modules/ReadonlyMap.ts.md
@@ -22,6 +22,8 @@ Added in v2.5.0
   - [partitionMap](#partitionmap)
 - [Functor](#functor)
   - [map](#map)
+- [FunctorWithIndex](#functorwithindex)
+  - [mapWithIndex](#mapwithindex)
 - [combinators](#combinators)
   - [deleteAt](#deleteat)
   - [insertAt](#insertat)
@@ -154,6 +156,18 @@ export declare const map: <A, B>(f: (a: A) => B) => <K>(fa: ReadonlyMap<K, A>) =
 
 Added in v2.5.0
 
+# FunctorWithIndex
+
+## mapWithIndex
+
+**Signature**
+
+```ts
+export declare const mapWithIndex: <K, A, B>(f: (k: K, a: A) => B) => (fa: ReadonlyMap<K, A>) => ReadonlyMap<K, B>
+```
+
+Added in v2.7.1
+
 # combinators
 
 ## deleteAt
diff --git a/dtslint/ts3.5/Array.ts b/dtslint/ts3.5/Array.ts
index 320bf974..ab2f8d41 100644
--- a/dtslint/ts3.5/Array.ts
+++ b/dtslint/ts3.5/Array.ts
@@ -1,6 +1,7 @@
 import * as _ from '../../src/Array'
 import { pipe } from '../../src/pipeable'
 import { eqNumber } from '../../src/Eq'
+import { Ord } from '../../src/Ord'
 
 declare const us: Array<unknown>
 declare const ns: Array<number>
@@ -133,3 +134,31 @@ _.zip(['a', 'b']) // $ExpectType <A>(as: A[]) => [A, string][]
 
 _.cons(0, [1, 2]) // $ExpectType NonEmptyArray<number>
 _.cons(0) // $ExpectType (tail: number[]) => NonEmptyArray<number>
+
+//
+// sort
+//
+
+declare const ord1: Ord<{ readonly a: string }>
+interface X1 {
+  readonly a: string
+  readonly b: number
+}
+declare const x1s: Array<X1>
+
+_.sort(ord1)(x1s) // $ExpectType X1[]
+
+//
+// sortBy
+//
+
+declare const ord2: Ord<X1>
+declare const ord3: Ord<X1>
+interface X2 {
+  readonly a: string
+  readonly b: number
+  readonly c: boolean
+}
+declare const x2s: Array<X2>
+
+_.sortBy([ord2, ord3])(x2s) // $ExpectType X2[]
diff --git a/dtslint/ts3.5/ReadonlyArray.ts b/dtslint/ts3.5/ReadonlyArray.ts
index cc6ffc52..d11f4b1e 100644
--- a/dtslint/ts3.5/ReadonlyArray.ts
+++ b/dtslint/ts3.5/ReadonlyArray.ts
@@ -1,6 +1,7 @@
 import * as _ from '../../src/ReadonlyArray'
 import { pipe } from '../../src/pipeable'
 import { eqNumber } from '../../src/Eq'
+import { Ord } from '../../src/Ord'
 
 declare const rus: ReadonlyArray<unknown>
 declare const rns: ReadonlyArray<number>
@@ -124,3 +125,31 @@ _.zip(['a', 'b']) // $ExpectType <A>(as: readonly A[]) => readonly (readonly [A,
 
 _.cons(0, [1, 2]) // $ExpectType ReadonlyNonEmptyArray<number>
 _.cons(0) // $ExpectType (tail: readonly number[]) => ReadonlyNonEmptyArray<number>
+
+//
+// sort
+//
+
+declare const ord1: Ord<{ readonly a: string }>
+interface X1 {
+  readonly a: string
+  readonly b: number
+}
+declare const x1s: ReadonlyArray<X1>
+
+_.sort(ord1)(x1s) // $ExpectType ReadonlyArray<X1>
+
+//
+// sortBy
+//
+
+declare const ord2: Ord<X1>
+declare const ord3: Ord<X1>
+interface X2 {
+  readonly a: string
+  readonly b: number
+  readonly c: boolean
+}
+declare const x2s: ReadonlyArray<X2>
+
+_.sortBy([ord2, ord3])(x2s) // $ExpectType ReadonlyArray<X2>
diff --git a/package-lock.json b/package-lock.json
index 4673e3a4..5161958b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "fp-ts",
-  "version": "2.7.0",
+  "version": "2.7.1",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {
@@ -6811,9 +6811,9 @@
       "dev": true
     },
     "typescript": {
-      "version": "3.9.2",
-      "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz",
-      "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==",
+      "version": "3.9.7",
+      "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
+      "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
       "dev": true
     },
     "unc-path-regex": {
diff --git a/package.json b/package.json
index 0593bf15..e39f36fd 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "fp-ts",
-  "version": "2.7.0",
+  "version": "2.7.1",
   "description": "Functional programming in TypeScript",
   "files": [
     "lib",
@@ -56,7 +56,7 @@
     "tslint": "5.11.0",
     "tslint-config-standard": "8.0.1",
     "tslint-immutable": "^6.0.1",
-    "typescript": "^3.9.2"
+    "typescript": "^3.9.7"
   },
   "tags": [
     "typescript",
diff --git a/src/Array.ts b/src/Array.ts
index bf961b03..eced2182 100644
--- a/src/Array.ts
+++ b/src/Array.ts
@@ -676,7 +676,7 @@ export const lefts: <E, A>(as: Array<Either<E, A>>) => Array<E> = RA.lefts as an
  * @category combinators
  * @since 2.0.0
  */
-export const sort: <A>(O: Ord<A>) => (as: Array<A>) => Array<A> = RA.sort as any
+export const sort: <B>(O: Ord<B>) => <A extends B>(as: Array<A>) => Array<A> = RA.sort as any
 
 /**
  * Apply a function to pairs of elements at the same index in two arrays, collecting the results in a new array. If one
@@ -801,7 +801,7 @@ export const uniq: <A>(E: Eq<A>) => (as: Array<A>) => Array<A> = RA.uniq as any
  * @category combinators
  * @since 2.0.0
  */
-export const sortBy: <A>(ords: Array<Ord<A>>) => (as: Array<A>) => Array<A> = RA.sortBy as any
+export const sortBy: <B>(ords: Array<Ord<B>>) => <A extends B>(as: Array<A>) => Array<A> = RA.sortBy as any
 
 /**
  * A useful recursion pattern for processing an array to produce a new array, often used for "chopping" up the input
@@ -980,7 +980,7 @@ export const of: <A>(a: A) => Array<A> = RA.of as any
 const map_: Monad1<URI>['map'] = RA.Monad.map as any
 const ap_: Monad1<URI>['ap'] = RA.Monad.ap as any
 const chain_: Monad1<URI>['chain'] = RA.Monad.chain as any
-const mapWithIndex_: FunctorWithIndex1<URI, number>['mapWithIndex'] = RA.Functor.mapWithIndex as any
+const mapWithIndex_: FunctorWithIndex1<URI, number>['mapWithIndex'] = RA.FunctorWithIndex.mapWithIndex as any
 const filter_: Filterable1<URI>['filter'] = RA.Filterable.filter as any
 const filterMap_: Filterable1<URI>['filterMap'] = RA.Filterable.filterMap as any
 const partition_: Filterable1<URI>['partition'] = RA.Filterable.partition as any
diff --git a/src/Map.ts b/src/Map.ts
index cc42b583..bb6c0748 100644
--- a/src/Map.ts
+++ b/src/Map.ts
@@ -277,7 +277,13 @@ export const filterMap: <A, B>(f: (a: A) => Option<B>) => <K>(fa: Map<K, A>) =>
  * @category Functor
  * @since 2.0.0
  */
-export const map: <A, B>(f: (a: A) => B) => <E>(fa: Map<E, A>) => Map<E, B> = RM.map as any
+export const map: <A, B>(f: (a: A) => B) => <K>(fa: Map<K, A>) => Map<K, B> = RM.map as any
+
+/**
+ * @category FunctorWithIndex
+ * @since 2.7.1
+ */
+export const mapWithIndex: <K, A, B>(f: (k: K, a: A) => B) => (fa: Map<K, A>) => Map<K, B> = RM.mapWithIndex as any
 
 /**
  * @category Filterable
diff --git a/src/ReadonlyArray.ts b/src/ReadonlyArray.ts
index 96b5a02d..9325e27f 100644
--- a/src/ReadonlyArray.ts
+++ b/src/ReadonlyArray.ts
@@ -973,9 +973,8 @@ export function lefts<E, A>(as: ReadonlyArray<Either<E, A>>): ReadonlyArray<E> {
  * @category combinators
  * @since 2.5.0
  */
-export function sort<A>(O: Ord<A>): (as: ReadonlyArray<A>) => ReadonlyArray<A> {
-  return (as) => (isEmpty(as) ? as : as.slice().sort(O.compare))
-}
+export const sort = <B>(O: Ord<B>) => <A extends B>(as: ReadonlyArray<A>): ReadonlyArray<A> =>
+  isEmpty(as) ? as : as.slice().sort(O.compare)
 
 // TODO: curry and make data-last in v3
 /**
@@ -1171,8 +1170,8 @@ export function uniq<A>(E: Eq<A>): (as: ReadonlyArray<A>) => ReadonlyArray<A> {
  * @category combinators
  * @since 2.5.0
  */
-export function sortBy<A>(ords: ReadonlyArray<Ord<A>>): (as: ReadonlyArray<A>) => ReadonlyArray<A> {
-  const M = getOrdMonoid<A>()
+export function sortBy<B>(ords: ReadonlyArray<Ord<B>>): <A extends B>(as: ReadonlyArray<A>) => ReadonlyArray<A> {
+  const M = getOrdMonoid<B>()
   return sort(ords.reduce(M.concat, M.empty))
 }
 
@@ -1948,7 +1947,7 @@ declare module './HKT' {
  * @category instances
  * @since 2.7.0
  */
-export const functorArray: Functor1<URI> = {
+export const Functor: Functor1<URI> = {
   URI,
   map: map_
 }
@@ -1957,7 +1956,7 @@ export const functorArray: Functor1<URI> = {
  * @category instances
  * @since 2.7.0
  */
-export const Functor: FunctorWithIndex1<URI, number> = {
+export const FunctorWithIndex: FunctorWithIndex1<URI, number> = {
   URI,
   map: map_,
   mapWithIndex: mapWithIndex_
diff --git a/src/ReadonlyMap.ts b/src/ReadonlyMap.ts
index 350a9017..cabcdb23 100644
--- a/src/ReadonlyMap.ts
+++ b/src/ReadonlyMap.ts
@@ -654,6 +654,14 @@ export const filterMap: <A, B>(f: (a: A) => Option<B>) => <K>(fa: ReadonlyMap<K,
  */
 export const map: <A, B>(f: (a: A) => B) => <K>(fa: ReadonlyMap<K, A>) => ReadonlyMap<K, B> = (f) => (fa) => map_(fa, f)
 
+/**
+ * @category FunctorWithIndex
+ * @since 2.7.1
+ */
+export const mapWithIndex: <K, A, B>(f: (k: K, a: A) => B) => (fa: ReadonlyMap<K, A>) => ReadonlyMap<K, B> = (f) => (
+  fa
+) => mapWithIndex_(fa, f)
+
 /**
  * @category Filterable
  * @since 2.5.0
diff --git a/src/ReadonlyNonEmptyArray.ts b/src/ReadonlyNonEmptyArray.ts
index df29a616..c2ddcd6c 100644
--- a/src/ReadonlyNonEmptyArray.ts
+++ b/src/ReadonlyNonEmptyArray.ts
@@ -376,8 +376,8 @@ export const unzip: <A, B>(
 // non-pipeables
 // -------------------------------------------------------------------------------------
 
-const map_: Functor1<URI>['map'] = RA.functorArray.map as any
-const mapWithIndex_: FunctorWithIndex1<URI, number>['mapWithIndex'] = RA.Functor.mapWithIndex as any
+const map_: Functor1<URI>['map'] = RA.Functor.map as any
+const mapWithIndex_: FunctorWithIndex1<URI, number>['mapWithIndex'] = RA.FunctorWithIndex.mapWithIndex as any
 const ap_: Apply1<URI>['ap'] = RA.Applicative.ap as any
 const chain_: Monad1<URI>['chain'] = RA.Monad.chain as any
 const extend_: Extend1<URI>['extend'] = RA.Extend.extend as any


Test patch:
diff --git a/test/Array.ts b/test/Array.ts
index 319dc0db..a14ee555 100644
--- a/test/Array.ts
+++ b/test/Array.ts
@@ -599,6 +599,23 @@ describe('Array', () => {
 
   it('sort', () => {
     assert.deepStrictEqual(_.sort(Ord.ordNumber)([3, 2, 1]), [1, 2, 3])
+    assert.strictEqual(_.sort(Ord.ordNumber)(_.empty), _.empty)
+    const byName = pipe(
+      Ord.ordString,
+      Ord.contramap((x: { readonly name: string }) => x.name)
+    )
+    assert.deepStrictEqual(
+      _.sort(byName)([
+        { name: 'b', age: 0 },
+        { name: 'a', age: 1 },
+        { name: 'c', age: 2 }
+      ]),
+      [
+        { name: 'a', age: 1 },
+        { name: 'b', age: 0 },
+        { name: 'c', age: 2 }
+      ]
+    )
   })
 
   it('zipWith', () => {
diff --git a/test/Compactable.ts b/test/Compactable.ts
index fd83fa56..c204fc25 100644
--- a/test/Compactable.ts
+++ b/test/Compactable.ts
@@ -6,7 +6,7 @@ import { left, right } from '../src/Either'
 
 describe('Compactable', () => {
   it('getCompactableComposition', () => {
-    const C = getCompactableComposition(A.functorArray, { ...A.functorArray, ...A.Compactable })
+    const C = getCompactableComposition(A.Functor, { ...A.Functor, ...A.Compactable })
     assert.deepStrictEqual(
       C.compact([
         [some(1), none],
diff --git a/test/Filterable.ts b/test/Filterable.ts
index a204aaf3..6a5a6fdf 100644
--- a/test/Filterable.ts
+++ b/test/Filterable.ts
@@ -6,7 +6,7 @@ import { right, left } from '../src/Either'
 
 describe('Filterable', () => {
   it('getFilterableComposition', () => {
-    const F = getFilterableComposition(A.functorArray, A.Filterable)
+    const F = getFilterableComposition(A.Functor, A.Filterable)
     assert.deepStrictEqual(
       F.filter(
         [
diff --git a/test/Functor.ts b/test/Functor.ts
index 9d04836c..9b69b7d2 100644
--- a/test/Functor.ts
+++ b/test/Functor.ts
@@ -5,7 +5,7 @@ import * as option from '../src/Option'
 
 describe('Functor', () => {
   it('getFunctorComposition', () => {
-    const arrayOption = getFunctorComposition(A.functorArray, option.Functor)
+    const arrayOption = getFunctorComposition(A.Functor, option.Functor)
     const double = (a: number) => a * 2
     assert.deepStrictEqual(arrayOption.map([option.some(1)], double), [option.some(2)])
   })
diff --git a/test/FunctorWithIndex.ts b/test/FunctorWithIndex.ts
index ae736b27..27ba828f 100644
--- a/test/FunctorWithIndex.ts
+++ b/test/FunctorWithIndex.ts
@@ -4,7 +4,7 @@ import { getFunctorWithIndexComposition } from '../src/FunctorWithIndex'
 
 describe('FunctorWithIndex', () => {
   it('getFunctorComposition', () => {
-    const arrayOfArray = getFunctorWithIndexComposition(A.Functor, A.Functor)
+    const arrayOfArray = getFunctorWithIndexComposition(A.FunctorWithIndex, A.FunctorWithIndex)
     const f = ([i, j]: readonly [number, number], a: string) => a + i + j
     assert.deepStrictEqual(
       arrayOfArray.mapWithIndex(
diff --git a/test/ReadonlyArray.ts b/test/ReadonlyArray.ts
index cf200986..1924642f 100644
--- a/test/ReadonlyArray.ts
+++ b/test/ReadonlyArray.ts
@@ -596,6 +596,22 @@ describe('ReadonlyArray', () => {
   it('sort', () => {
     assert.deepStrictEqual(_.sort(Ord.ordNumber)([3, 2, 1]), [1, 2, 3])
     assert.strictEqual(_.sort(Ord.ordNumber)(_.empty), _.empty)
+    const byName = pipe(
+      Ord.ordString,
+      Ord.contramap((x: { readonly name: string }) => x.name)
+    )
+    assert.deepStrictEqual(
+      _.sort(byName)([
+        { name: 'b', age: 0 },
+        { name: 'a', age: 1 },
+        { name: 'c', age: 2 }
+      ]),
+      [
+        { name: 'a', age: 1 },
+        { name: 'b', age: 0 },
+        { name: 'c', age: 2 }
+      ]
+    )
   })
 
   it('zipWith', () => {
@@ -920,7 +936,7 @@ describe('ReadonlyArray', () => {
       readonly bar: () => number
     }
     const f = (a: number, x?: Foo) => (x !== undefined ? `${a}${x.bar()}` : `${a}`)
-    assert.deepStrictEqual(_.functorArray.map([1, 2], f), ['1', '2'])
+    assert.deepStrictEqual(_.Functor.map([1, 2], f), ['1', '2'])
     assert.deepStrictEqual(pipe([1, 2], _.map(f)), ['1', '2'])
   })
 
diff --git a/test/ReadonlyMap.ts b/test/ReadonlyMap.ts
index 2902ec82..2d96877d 100644
--- a/test/ReadonlyMap.ts
+++ b/test/ReadonlyMap.ts
@@ -791,16 +791,6 @@ describe('ReadonlyMap', () => {
       assert.deepStrictEqual(log, ['a', 'b'])
     })
 
-    it('mapWithIndex', () => {
-      const mapWithIndex = W.mapWithIndex
-      const aa1 = new Map<User, number>([[{ id: 'aa' }, 1]])
-      const aa3 = new Map<User, number>([[{ id: 'aa' }, 3]])
-      assert.deepStrictEqual(
-        mapWithIndex(aa1, (k, a) => a + k.id.length),
-        aa3
-      )
-    })
-
     it('reduce', () => {
       const d1 = new Map<User, string>([
         [{ id: 'k1' }, 'a'],
@@ -1134,4 +1124,16 @@ describe('ReadonlyMap', () => {
     assert.deepStrictEqual(bs, as)
     assert.notStrictEqual(bs, as)
   })
+
+  it('mapWithIndex', () => {
+    const aa1 = new Map<User, number>([[{ id: 'aa' }, 1]])
+    const aa3 = new Map<User, number>([[{ id: 'aa' }, 3]])
+    assert.deepStrictEqual(
+      pipe(
+        aa1,
+        _.mapWithIndex((k, a) => a + k.id.length)
+      ),
+      aa3
+    )
+  })
 })
diff --git a/test/Store.ts b/test/Store.ts
index a71cab7e..a562221a 100644
--- a/test/Store.ts
+++ b/test/Store.ts
@@ -80,7 +80,7 @@ describe('Store', () => {
     assert.deepStrictEqual(
       pipe(
         wa,
-        _.experiment(A.functorArray)((s) => [s, s + 'a'])
+        _.experiment(A.Functor)((s) => [s, s + 'a'])
       ),
       [1, 2]
     )
diff --git a/test/pipeable.ts b/test/pipeable.ts
index 52972bd6..0a12077d 100644
--- a/test/pipeable.ts
+++ b/test/pipeable.ts
@@ -14,7 +14,7 @@ describe('pipeable', () => {
   })
 
   it('Functor', () => {
-    const { map } = pipeable(A.functorArray)
+    const { map } = pipeable(A.Functor)
     assert.deepStrictEqual(map((n: number) => n * 2)([1, 2, 3]), [2, 4, 6])
   })
 
@@ -24,7 +24,7 @@ describe('pipeable', () => {
   })
 
   it('FunctorWithIndex', () => {
-    const { mapWithIndex } = pipeable(A.Functor)
+    const { mapWithIndex } = pipeable(A.FunctorWithIndex)
     assert.deepStrictEqual(mapWithIndex((i, n: number) => n * 2 + i)([1, 2, 3]), [2, 5, 8])
   })