diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 33e15836c1..67af800a22 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,28 +2,27 @@ name: Node.js CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: jobs: build: - runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] + node-version: [16.x] steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm install - - run: npm run build --if-present - - run: npm test + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm run build --if-present + - run: npm test diff --git a/CHANGELOG.md b/CHANGELOG.md index 764fbf3ddd..799fe76b9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ **Note**: A feature tagged as Experimental is in a high state of flux, you're at risk of it changing without notice. +# 2.12.2 + +- **Polish** + - `ReadonlyRecord` / `Record` + - add `Applicative4` overloadings to `traverse` / `traverseWithIndex`, #1733 (@mlegenhausen) + # 2.12.1 - **Bug Fix** diff --git a/docs/modules/ReadonlyRecord.ts.md b/docs/modules/ReadonlyRecord.ts.md index 98c7ce8e7d..4ce3a1bfaf 100644 --- a/docs/modules/ReadonlyRecord.ts.md +++ b/docs/modules/ReadonlyRecord.ts.md @@ -1888,6 +1888,11 @@ Added in v2.5.0 **Signature** ```ts +export declare function traverse( + F: Applicative4 +): ( + f: (a: A) => Kind4 +) => (ta: ReadonlyRecord) => Kind4> export declare function traverse( F: Applicative3 ): ( @@ -1923,6 +1928,11 @@ Added in v2.5.0 **Signature** ```ts +export declare function traverseWithIndex( + F: Applicative4 +): ( + f: (k: K, a: A) => Kind4 +) => (ta: ReadonlyRecord) => Kind4> export declare function traverseWithIndex( F: Applicative3 ): ( diff --git a/docs/modules/Record.ts.md b/docs/modules/Record.ts.md index 068236abdb..79c913399b 100644 --- a/docs/modules/Record.ts.md +++ b/docs/modules/Record.ts.md @@ -1783,6 +1783,11 @@ Added in v2.0.0 **Signature** ```ts +export declare function traverse( + F: Applicative4 +): ( + f: (a: A) => Kind4 +) => (ta: Record) => Kind4> export declare function traverse( F: Applicative3 ): (f: (a: A) => Kind3) => (ta: Record) => Kind3> @@ -1810,6 +1815,11 @@ Added in v2.0.0 **Signature** ```ts +export declare function traverseWithIndex( + F: Applicative4 +): ( + f: (k: K, a: A) => Kind4 +) => (ta: Record) => Kind4> export declare function traverseWithIndex( F: Applicative3 ): ( diff --git a/package-lock.json b/package-lock.json index 3315bf0642..9fb41eaf87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "ts-node": "^8.0.2", "tslint": "5.11.0", "tslint-config-standard": "8.0.1", - "tslint-immutable": "^6.0.1", "typescript": "^4.2.3" } }, @@ -9258,19 +9257,6 @@ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", "dev": true }, - "node_modules/tslint-immutable": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/tslint-immutable/-/tslint-immutable-6.0.1.tgz", - "integrity": "sha512-3GQ6HffN64gLmT/N1YzyVMqyf6uBjMvhNaevK8B0K01/QC0OU5AQZrH4TjMHo1IdG3JpqsZvuRy9IW1LA3zjwA==", - "dev": true, - "dependencies": { - "tsutils": "^2.28.0 || ^3.0.0" - }, - "peerDependencies": { - "tslint": "^5.8.0", - "typescript": "^2.8.0 || ^3.0.0" - } - }, "node_modules/tslint/node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", @@ -12237,7 +12223,7 @@ "dtslint": { "version": "git+ssh://git@github.com/gcanti/dtslint.git#c0477576034b0864b821b9dc9e386029c1528fb9", "dev": true, - "from": "dtslint@gcanti/dtslint", + "from": "dtslint@github:gcanti/dtslint", "requires": { "fs-extra": "^6.0.1", "parsimmon": "^1.12.0", @@ -17249,15 +17235,6 @@ } } }, - "tslint-immutable": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/tslint-immutable/-/tslint-immutable-6.0.1.tgz", - "integrity": "sha512-3GQ6HffN64gLmT/N1YzyVMqyf6uBjMvhNaevK8B0K01/QC0OU5AQZrH4TjMHo1IdG3JpqsZvuRy9IW1LA3zjwA==", - "dev": true, - "requires": { - "tsutils": "^2.28.0 || ^3.0.0" - } - }, "tsutils": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.5.0.tgz", diff --git a/package.json b/package.json index 6b2e6c5e5c..c73b76f94a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fp-ts", - "version": "2.12.1", + "version": "2.12.2", "description": "Functional programming in TypeScript", "main": "lib/index.js", "module": "es6/index.js", @@ -54,7 +54,6 @@ "ts-node": "^8.0.2", "tslint": "5.11.0", "tslint-config-standard": "8.0.1", - "tslint-immutable": "^6.0.1", "typescript": "^4.2.3" }, "tags": [ diff --git a/src/ReadonlyRecord.ts b/src/ReadonlyRecord.ts index e18e40cb46..f3de78c680 100644 --- a/src/ReadonlyRecord.ts +++ b/src/ReadonlyRecord.ts @@ -6,7 +6,15 @@ * * @since 2.5.0 */ -import { Applicative, Applicative1, Applicative2, Applicative2C, Applicative3, Applicative3C } from './Applicative' +import { + Applicative, + Applicative1, + Applicative2, + Applicative2C, + Applicative3, + Applicative3C, + Applicative4 +} from './Applicative' import { Compactable1 } from './Compactable' import { Either } from './Either' import { Eq, fromEquals } from './Eq' @@ -17,7 +25,7 @@ import { FoldableWithIndex1 } from './FoldableWithIndex' import { flow, identity, pipe, SK } from './function' import { flap as flap_, Functor1 } from './Functor' import { FunctorWithIndex1 } from './FunctorWithIndex' -import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from './HKT' +import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT' import * as _ from './internal' import { Magma } from './Magma' import { Monoid } from './Monoid' @@ -663,6 +671,11 @@ export const singleton = (k: string, a: A): ReadonlyRecord => ({ [ /** * @since 2.5.0 */ +export function traverseWithIndex( + F: Applicative4 +): ( + f: (k: K, a: A) => Kind4 +) => (ta: ReadonlyRecord) => Kind4> export function traverseWithIndex( F: Applicative3 ): ( @@ -701,6 +714,11 @@ export function traverseWithIndex( /** * @since 2.5.0 */ +export function traverse( + F: Applicative4 +): ( + f: (a: A) => Kind4 +) => (ta: ReadonlyRecord) => Kind4> export function traverse( F: Applicative3 ): ( diff --git a/src/Record.ts b/src/Record.ts index 9521c41897..f73ead7380 100644 --- a/src/Record.ts +++ b/src/Record.ts @@ -4,7 +4,15 @@ * * @since 2.0.0 */ -import { Applicative, Applicative1, Applicative2, Applicative2C, Applicative3, Applicative3C } from './Applicative' +import { + Applicative, + Applicative1, + Applicative2, + Applicative2C, + Applicative3, + Applicative3C, + Applicative4 +} from './Applicative' import * as A from './Array' import { Compactable1 } from './Compactable' import { Either } from './Either' @@ -16,7 +24,7 @@ import { FoldableWithIndex1 } from './FoldableWithIndex' import { pipe } from './function' import { flap as flap_, Functor1 } from './Functor' import { FunctorWithIndex1 } from './FunctorWithIndex' -import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from './HKT' +import { HKT, Kind, Kind2, Kind3, Kind4, URIS, URIS2, URIS3, URIS4 } from './HKT' import * as _ from './internal' import { Magma } from './Magma' import { Monoid } from './Monoid' @@ -500,6 +508,11 @@ export const singleton: (k: string, a: A) => Record = RR.singleton /** * @since 2.0.0 */ +export function traverseWithIndex( + F: Applicative4 +): ( + f: (k: K, a: A) => Kind4 +) => (ta: Record) => Kind4> export function traverseWithIndex( F: Applicative3 ): ( @@ -531,6 +544,11 @@ export function traverseWithIndex( /** * @since 2.0.0 */ +export function traverse( + F: Applicative4 +): ( + f: (a: A) => Kind4 +) => (ta: Record) => Kind4> export function traverse( F: Applicative3 ): (f: (a: A) => Kind3) => (ta: Record) => Kind3> diff --git a/tslint.json b/tslint.json index c4e921dba7..d4274265e6 100644 --- a/tslint.json +++ b/tslint.json @@ -1,5 +1,5 @@ { - "extends": ["tslint-config-standard", "tslint-immutable"], + "extends": "tslint-config-standard", "rules": { "space-before-function-paren": false, "no-use-before-declare": false, @@ -10,7 +10,6 @@ "forin": true, "no-console": true, "array-type": [true, "generic"], - "readonly-keyword": true, "strict-type-predicates": false } }