Skip to content

Commit

Permalink
bump required fp-ts version
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Mar 8, 2021
1 parent 4dc860a commit 3264973
Show file tree
Hide file tree
Showing 20 changed files with 55 additions and 50 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ high state of flux, you're at risk of it changing without notice.

# 2.3.8

Experimental modules require `fp-ts@^2.5.0`.

- **Experimental**
- `Lens`
- add `composeIso` (@gcanti)
Expand Down
2 changes: 1 addition & 1 deletion dtslint/ts3.5/Lens.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as L from '../../src/Lens'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'

interface A {
a: string
Expand Down
2 changes: 1 addition & 1 deletion dtslint/ts3.5/Optional.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as O from '../../src/Optional'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'

interface A {
a: string
Expand Down
2 changes: 1 addition & 1 deletion dtslint/ts3.5/Prism.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as P from '../../src/Prism'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'

interface A {
a: string
Expand Down
2 changes: 1 addition & 1 deletion dtslint/ts3.5/Traversal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as T from '../../src/Traversal'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'

interface A {
a: string
Expand Down
14 changes: 10 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
},
"homepage": "https://github.com/gcanti/monocle-ts",
"peerDependencies": {
"fp-ts": "^2.0.0"
"fp-ts": "^2.5.0"
},
"devDependencies": {
"@types/glob": "^7.1.3",
"@types/jest": "22.2.2",
"@types/node": "^13.11.0",
"docs-ts": "^0.6.2",
"dtslint": "github:gcanti/dtslint",
"fp-ts": "^2.9.5",
"fp-ts": "^2.5.0",
"import-path-rewrite": "github:gcanti/import-path-rewrite",
"jest": "^24.3.0",
"mocha": "^5.2.0",
Expand Down
6 changes: 3 additions & 3 deletions scripts/FileSystem.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as TE from 'fp-ts/TaskEither'
import { flow } from 'fp-ts/function'
import * as TE from 'fp-ts/lib/TaskEither'
import { flow } from 'fp-ts/lib/function'
import * as fs from 'fs'
import * as G from 'glob'

Expand All @@ -25,6 +25,6 @@ export const fileSystem: FileSystem = {
mkdir: flow(
mkdirTE,
TE.map(() => undefined),
TE.orElse((e) => (e.code === 'EEXIST' ? TE.of(undefined) : TE.left(e)))
TE.orElse((e) => (e.code === 'EEXIST' ? TE.right(undefined) : TE.left(e)))
)
}
21 changes: 9 additions & 12 deletions scripts/build.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as path from 'path'
import * as E from 'fp-ts/Either'
import { pipe } from 'fp-ts/function'
import * as RTE from 'fp-ts/ReaderTaskEither'
import * as A from 'fp-ts/ReadonlyArray'
import * as TE from 'fp-ts/TaskEither'
import * as E from 'fp-ts/lib/Either'
import { pipe } from 'fp-ts/lib/pipeable'
import * as RTE from 'fp-ts/lib/ReaderTaskEither'
import * as A from 'fp-ts/lib/ReadonlyArray'
import * as TE from 'fp-ts/lib/TaskEither'
import { FileSystem, fileSystem } from './FileSystem'
import { run } from './run'
import * as O from 'fp-ts/Option'
import * as O from 'fp-ts/lib/Option'

interface Build<A> extends RTE.ReaderTaskEither<FileSystem, Error, A> {}

Expand All @@ -32,18 +32,15 @@ export const copyPackageJson: Build<void> = (C) =>
export const FILES: ReadonlyArray<string> = ['CHANGELOG.md', 'LICENSE', 'README.md']

export const copyFiles: Build<ReadonlyArray<void>> = (C) =>
pipe(
FILES,
A.traverse(TE.taskEither)((from) => C.copyFile(from, path.resolve(OUTPUT_FOLDER, from)))
)
A.readonlyArray.traverse(TE.taskEither)(FILES, (from) => C.copyFile(from, path.resolve(OUTPUT_FOLDER, from)))

const traverse = A.traverse(TE.taskEither)
const traverse = A.readonlyArray.traverse(TE.taskEither)

export const makeModules: Build<void> = (C) =>
pipe(
C.glob(`${OUTPUT_FOLDER}/lib/**/*.js`),
TE.map(getModules),
TE.chain(traverse(makeSingleModule(C))),
TE.chain((modules) => traverse(modules, makeSingleModule(C))),
TE.map(() => undefined)
)

Expand Down
2 changes: 1 addition & 1 deletion scripts/pre-publish.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { left } from 'fp-ts/TaskEither'
import { left } from 'fp-ts/lib/TaskEither'
import { run } from './run'

const main = left(new Error('"npm publish" can not be run from root, run "npm run release" instead'))
Expand Down
4 changes: 2 additions & 2 deletions scripts/release.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { run } from './run'
import * as child_process from 'child_process'
import { left, right } from 'fp-ts/Either'
import * as TE from 'fp-ts/TaskEither'
import { left, right } from 'fp-ts/lib/Either'
import * as TE from 'fp-ts/lib/TaskEither'

const DIST = 'dist'

Expand Down
4 changes: 2 additions & 2 deletions scripts/run.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fold } from 'fp-ts/Either'
import { TaskEither } from 'fp-ts/TaskEither'
import { fold } from 'fp-ts/lib/Either'
import { TaskEither } from 'fp-ts/lib/TaskEither'

export function run<A>(eff: TaskEither<Error, A>): void {
eff()
Expand Down
4 changes: 2 additions & 2 deletions src/At.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const atReadonlyMap = <K>(E: Eq<K>): (<A = never>() => At<ReadonlyMap<K,
const insertAtE = RM.insertAt(E)
return () => ({
at: (key) => ({
get: lookupE(key),
get: (s) => lookupE(key, s),
set: O.fold(
() => deleteAtE(key),
(a) => insertAtE(key, a)
Expand All @@ -82,7 +82,7 @@ export const atReadonlySet = <A>(E: Eq<A>): At<ReadonlySet<A>, A, boolean> => {
const insert = insertE(a)
const remove = removeE(a)
return {
get: elemE(a),
get: (s) => elemE(a, s),
set: (b) => (s) => (b ? insert(s) : remove(s))
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/Iso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
* @since 2.3.0
*/
import { Category2 } from 'fp-ts/lib/Category'
import { flow, identity, pipe } from 'fp-ts/lib/function'
import { flow, identity } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'
import { Functor, Functor1, Functor2, Functor3 } from 'fp-ts/lib/Functor'
import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from 'fp-ts/lib/HKT'
import { Invariant2 } from 'fp-ts/lib/Invariant'
Expand Down
5 changes: 2 additions & 3 deletions src/Ix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,13 @@ export const indexReadonlyMap = <K>(E: Eq<K>): (<A = never>() => Index<ReadonlyM
const insertAtE = RM.insertAt(E)
return () => ({
index: (key) => {
const lookup = lookupE(key)
return {
getOption: lookup,
getOption: (s) => lookupE(key, s),
set: (next) => {
const insert = insertAtE(key, next)
return (s) =>
pipe(
lookup(s),
lookupE(key, s),
O.fold(
() => s,
(prev) => (next === prev ? s : insert(s))
Expand Down
4 changes: 2 additions & 2 deletions test/Iso.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as assert from 'assert'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'
import * as _ from '../src/Iso'
import * as Id from 'fp-ts/lib/Identity'
import * as O from 'fp-ts/lib/Option'
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('Iso', () => {
it('modifyF', () => {
const f = pipe(
double,
_.modifyF(O.Functor)((n) => (n > 0 ? O.some(n * 2) : O.none))
_.modifyF(O.option)((n) => (n > 0 ? O.some(n * 2) : O.none))
)
assert.deepStrictEqual(f(1), O.some(2))
assert.deepStrictEqual(f(-1), O.none)
Expand Down
6 changes: 3 additions & 3 deletions test/Lens.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as assert from 'assert'
import * as _ from '../src/Lens'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'
import * as O from 'fp-ts/lib/Option'
import * as A from 'fp-ts/lib/ReadonlyArray'
import * as T from '../src/Traversal'
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('Lens', () => {
const sa = pipe(_.id<S>(), _.prop('a'))
const ab = T.fromTraversable(A.readonlyArray)<number>()
const sb = pipe(sa, _.composeTraversal(ab))
assert.deepStrictEqual(sb.modifyF(Id.Applicative)((n) => n * 2)({ a: [1, 2, 3] }), { a: [2, 4, 6] })
assert.deepStrictEqual(sb.modifyF(Id.identity)((n) => n * 2)({ a: [1, 2, 3] }), { a: [2, 4, 6] })
})

it('id', () => {
Expand Down Expand Up @@ -241,7 +241,7 @@ describe('Lens', () => {
const sa: _.Lens<S, number> = pipe(_.id<S>(), _.prop('a'))
const f = pipe(
sa,
_.modifyF(O.Functor)((n) => (n > 0 ? O.some(n * 2) : O.none))
_.modifyF(O.option)((n) => (n > 0 ? O.some(n * 2) : O.none))
)
assert.deepStrictEqual(f({ a: 1 }), O.some({ a: 2 }))
assert.deepStrictEqual(f({ a: -1 }), O.none)
Expand Down
8 changes: 4 additions & 4 deletions test/Optional.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as assert from 'assert'
import * as O from 'fp-ts/lib/Option'
import * as _ from '../src/Optional'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'
import * as Id from 'fp-ts/lib/Identity'
import * as A from 'fp-ts/lib/ReadonlyArray'
import * as T from '../src/Traversal'
Expand Down Expand Up @@ -72,8 +72,8 @@ describe('Optional', () => {
const sa = pipe(L.id<S>(), L.prop('a'), L.some)
const ab = T.fromTraversable(A.readonlyArray)<number>()
const sb = pipe(sa, _.composeTraversal(ab))
assert.deepStrictEqual(sb.modifyF(Id.Applicative)((n) => n * 2)({ a: O.none }), { a: O.none })
assert.deepStrictEqual(sb.modifyF(Id.Applicative)((n) => n * 2)({ a: O.some([1, 2, 3]) }), { a: O.some([2, 4, 6]) })
assert.deepStrictEqual(sb.modifyF(Id.identity)((n) => n * 2)({ a: O.none }), { a: O.none })
assert.deepStrictEqual(sb.modifyF(Id.identity)((n) => n * 2)({ a: O.some([1, 2, 3]) }), { a: O.some([2, 4, 6]) })
})

it('id', () => {
Expand Down Expand Up @@ -196,7 +196,7 @@ describe('Optional', () => {
const sa = pipe(_.id<ReadonlyArray<number>>(), _.index(0))
const f = pipe(
sa,
_.modifyF(O.Applicative)((n) => (n > 0 ? O.some(n * 2) : O.none))
_.modifyF(O.option)((n) => (n > 0 ? O.some(n * 2) : O.none))
)
assert.deepStrictEqual(f([]), O.some([]))
assert.deepStrictEqual(f([1, 2, 3]), O.some([2, 2, 3]))
Expand Down
8 changes: 4 additions & 4 deletions test/Prism.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as assert from 'assert'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'
import * as O from 'fp-ts/lib/Option'
import * as E from 'fp-ts/lib/Either'
import * as _ from '../src/Prism'
Expand Down Expand Up @@ -162,8 +162,8 @@ describe('Prism', () => {
const sa = pipe(_.id<S>(), _.some)
const ab = T.fromTraversable(A.readonlyArray)<number>()
const sb = pipe(sa, _.composeTraversal(ab))
assert.deepStrictEqual(sb.modifyF(Id.Applicative)((n) => n * 2)(O.none), O.none)
assert.deepStrictEqual(sb.modifyF(Id.Applicative)((n) => n * 2)(O.some([1, 2, 3])), O.some([2, 4, 6]))
assert.deepStrictEqual(sb.modifyF(Id.identity)((n) => n * 2)(O.none), O.none)
assert.deepStrictEqual(sb.modifyF(Id.identity)((n) => n * 2)(O.some([1, 2, 3])), O.some([2, 4, 6]))
})

it('right', () => {
Expand Down Expand Up @@ -245,7 +245,7 @@ describe('Prism', () => {
it('modifyF', () => {
const f = pipe(
value,
_.modifyF(O.Applicative)((n) => (n > 0 ? O.some(n * 2) : O.none))
_.modifyF(O.option)((n) => (n > 0 ? O.some(n * 2) : O.none))
)
assert.deepStrictEqual(f(node(1, leaf, leaf)), O.some(node(2, leaf, leaf)))
assert.deepStrictEqual(f(leaf), O.some(leaf))
Expand Down
2 changes: 1 addition & 1 deletion test/Traversal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as _ from '../src/Traversal'
import * as A from 'fp-ts/lib/ReadonlyArray'
import * as Id from 'fp-ts/lib/Identity'
import * as O from 'fp-ts/lib/Option'
import { pipe } from 'fp-ts/lib/function'
import { pipe } from 'fp-ts/lib/pipeable'
import { monoidSum } from 'fp-ts/lib/Monoid'

describe('Traversal', () => {
Expand Down

0 comments on commit 3264973

Please sign in to comment.