Repository: gcanti/fp-ts
Pull request #886 (2019-06-22 05:41:30)

version 1.19.1


Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7640be59..0252882e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,11 @@
 **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.
 
+# 1.19.1
+
+- **Bug Fix**
+  - use default type parameters for constructors / lifting functions (@gcanti)
+
 # 1.19.0
 
 The goal of this release is to make the migration to v2 easier.
diff --git a/docs/modules/Const.ts.md b/docs/modules/Const.ts.md
index b7eb9823..92083362 100644
--- a/docs/modules/Const.ts.md
+++ b/docs/modules/Const.ts.md
@@ -162,7 +162,7 @@ Added in v1.17.0
 **Signature**
 
 ```ts
-export function make<L>(l: L): Const<L, never> { ... }
+export function make<L, A = never>(l: L): Const<L, A> { ... }
 ```
 
 Added in v1.19.0
diff --git a/docs/modules/IOEither.ts.md b/docs/modules/IOEither.ts.md
index 21b6b0a8..836ab6e3 100644
--- a/docs/modules/IOEither.ts.md
+++ b/docs/modules/IOEither.ts.md
@@ -218,7 +218,7 @@ Added in v1.6.0
 **Signature**
 
 ```ts
-export const left2v: <L>(l: L) => IOEither<L, never> = ...
+export const left2v: <E = ...
 ```
 
 Added in v1.19.0
@@ -228,7 +228,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export const leftIO: <E>(me: IO<E>) => IOEither<E, never> = ...
+export const leftIO: <E = ...
 ```
 
 Added in v1.19.0
@@ -238,7 +238,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export const rightIO: <A>(ma: IO<A>) => IOEither<never, A> = ...
+export const rightIO: <E = ...
 ```
 
 Added in v1.19.0
@@ -314,7 +314,7 @@ Added in v1.6.0
 **Signature**
 
 ```ts
-export function right2v<A>(a: A): IOEither<never, A> { ... }
+export function right2v<E = never, A = never>(a: A): IOEither<E, A> { ... }
 ```
 
 Added in v1.19.0
diff --git a/docs/modules/ReaderTaskEither.ts.md b/docs/modules/ReaderTaskEither.ts.md
index 45f0ce20..1e19cc94 100644
--- a/docs/modules/ReaderTaskEither.ts.md
+++ b/docs/modules/ReaderTaskEither.ts.md
@@ -197,7 +197,7 @@ export const URI = ...
 **Signature**
 
 ```ts
-export const left2v: <E, L>(e: L) => ReaderTaskEither<E, L, never> = ...
+export const left2v: <R, E = ...
 ```
 
 Added in v1.19.0
@@ -207,7 +207,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export const leftTask: <E, L, A>(fa: Task<L>) => ReaderTaskEither<E, L, A> = ...
+export const leftTask: <R, E = ...
 ```
 
 Added in v1.19.0
@@ -244,7 +244,7 @@ Added in v1.10.0
 **Signature**
 
 ```ts
-export const right2v: <E, A>(a: A) => ReaderTaskEither<E, never, A> = ...
+export const right2v: <R, E = ...
 ```
 
 Added in v1.19.0
@@ -254,7 +254,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export const rightIO: <E, A>(ma: IO<A>) => ReaderTaskEither<E, never, A> = ...
+export const rightIO: <R, E = ...
 ```
 
 Added in v1.19.0
@@ -264,7 +264,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export const rightReader: <E, A>(ma: Reader<E, A>) => ReaderTaskEither<E, never, A> = ...
+export const rightReader: <R, E = ...
 ```
 
 Added in v1.19.0
@@ -274,7 +274,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export const rightTask: <E, L, A>(fa: Task<A>) => ReaderTaskEither<E, L, A> = ...
+export const rightTask: <R, E = ...
 ```
 
 Added in v1.19.0
diff --git a/docs/modules/TaskEither.ts.md b/docs/modules/TaskEither.ts.md
index 1acbbd51..f0fe307f 100644
--- a/docs/modules/TaskEither.ts.md
+++ b/docs/modules/TaskEither.ts.md
@@ -469,7 +469,7 @@ Added in v1.0.0
 **Signature**
 
 ```ts
-export function left2v<L>(l: L): TaskEither<L, never> { ... }
+export function left2v<E = never, A = never>(e: E): TaskEither<E, A> { ... }
 ```
 
 Added in v1.19.0
@@ -479,7 +479,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export function leftIO<E>(me: IO<E>): TaskEither<E, never> { ... }
+export function leftIO<E = never, A = never>(me: IO<E>): TaskEither<E, A> { ... }
 ```
 
 Added in v1.19.0
@@ -489,7 +489,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export function leftTask<E>(me: Task<E>): TaskEither<E, never> { ... }
+export function leftTask<E = never, A = never>(me: Task<E>): TaskEither<E, A> { ... }
 ```
 
 Added in v1.19.0
@@ -521,7 +521,7 @@ Added in v1.0.0
 **Signature**
 
 ```ts
-export function right2v<A>(a: A): TaskEither<never, A> { ... }
+export function right2v<E = never, A = never>(a: A): TaskEither<E, A> { ... }
 ```
 
 Added in v1.19.0
@@ -531,7 +531,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export function rightIO<A>(ma: IO<A>): TaskEither<never, A> { ... }
+export function rightIO<E = never, A = never>(ma: IO<A>): TaskEither<E, A> { ... }
 ```
 
 Added in v1.19.0
@@ -541,7 +541,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export function rightTask<A>(ma: Task<A>): TaskEither<never, A> { ... }
+export function rightTask<E = never, A = never>(ma: Task<A>): TaskEither<E, A> { ... }
 ```
 
 Added in v1.19.0
diff --git a/docs/modules/These.ts.md b/docs/modules/These.ts.md
index 36aab060..fe5f3ba8 100644
--- a/docs/modules/These.ts.md
+++ b/docs/modules/These.ts.md
@@ -513,7 +513,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export const left: <E>(left: E) => These<E, never> = ...
+export const left: <E = ...
 ```
 
 Added in v1.19.0
@@ -523,7 +523,7 @@ Added in v1.19.0
 **Signature**
 
 ```ts
-export const right: <A>(right: A) => These<never, A> = ...
+export const right: <E = ...
 ```
 
 Added in v1.19.0
diff --git a/package.json b/package.json
index bdc3fbf7..fee7b76f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "fp-ts",
-  "version": "1.19.0",
+  "version": "1.19.1",
   "description": "Functional programming in TypeScript",
   "files": [
     "lib",
diff --git a/src/Const.ts b/src/Const.ts
index 7a1de7f9..b7e9e591 100644
--- a/src/Const.ts
+++ b/src/Const.ts
@@ -115,7 +115,7 @@ export const const_: Functor2<URI> & Contravariant2<URI> = {
 /**
  * @since 1.19.0
  */
-export function make<L>(l: L): Const<L, never> {
+export function make<L, A = never>(l: L): Const<L, A> {
   // tslint:disable-next-line: deprecation
   return new Const(l)
 }
diff --git a/src/IOEither.ts b/src/IOEither.ts
index 82937e4a..97626489 100644
--- a/src/IOEither.ts
+++ b/src/IOEither.ts
@@ -193,12 +193,12 @@ export const ioEither: Monad2<URI> & Bifunctor2<URI> & Alt2<URI> & MonadThrow2<U
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const left2v: <L>(l: L) => IOEither<L, never> = fromLeft
+export const left2v: <E = never, A = never>(l: E) => IOEither<E, A> = fromLeft
 
 /**
  * @since 1.19.0
  */
-export function right2v<A>(a: A): IOEither<never, A> {
+export function right2v<E = never, A = never>(a: A): IOEither<E, A> {
   return new IOEither(T.of(a))
 }
 
@@ -206,13 +206,13 @@ export function right2v<A>(a: A): IOEither<never, A> {
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const rightIO: <A>(ma: IO<A>) => IOEither<never, A> = right
+export const rightIO: <E = never, A = never>(ma: IO<A>) => IOEither<E, A> = right
 
 /**
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const leftIO: <E>(me: IO<E>) => IOEither<E, never> = left
+export const leftIO: <E = never, A = never>(me: IO<E>) => IOEither<E, A> = left
 
 /**
  * @since 1.19.0
diff --git a/src/ReaderTaskEither.ts b/src/ReaderTaskEither.ts
index 79665fe1..05ead137 100644
--- a/src/ReaderTaskEither.ts
+++ b/src/ReaderTaskEither.ts
@@ -254,36 +254,36 @@ export const readerTaskEitherSeq: typeof readerTaskEither = {
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const left2v: <E, L>(e: L) => ReaderTaskEither<E, L, never> = fromLeft
+export const left2v: <R, E = never, A = never>(e: E) => ReaderTaskEither<R, E, A> = fromLeft
 
 /**
  * @since 1.19.0
  */
-export const right2v: <E, A>(a: A) => ReaderTaskEither<E, never, A> = readerTaskEither.of
+export const right2v: <R, E = never, A = never>(a: A) => ReaderTaskEither<R, E, A> = readerTaskEither.of
 
 /**
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const rightReader: <E, A>(ma: Reader<E, A>) => ReaderTaskEither<E, never, A> = fromReader
+export const rightReader: <R, E = never, A = never>(ma: Reader<R, A>) => ReaderTaskEither<R, E, A> = fromReader
 
 /**
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const rightIO: <E, A>(ma: IO<A>) => ReaderTaskEither<E, never, A> = fromIO
+export const rightIO: <R, E = never, A = never>(ma: IO<A>) => ReaderTaskEither<R, E, A> = fromIO
 
 /**
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const rightTask: <E, L, A>(fa: Task<A>) => ReaderTaskEither<E, L, A> = right
+export const rightTask: <R, E = never, A = never>(fa: Task<A>) => ReaderTaskEither<R, E, A> = right
 
 /**
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const leftTask: <E, L, A>(fa: Task<L>) => ReaderTaskEither<E, L, A> = left
+export const leftTask: <R, E = never, A = never>(fa: Task<E>) => ReaderTaskEither<R, E, A> = left
 
 const {
   alt,
diff --git a/src/TaskEither.ts b/src/TaskEither.ts
index b6c08e25..38b0c4c3 100644
--- a/src/TaskEither.ts
+++ b/src/TaskEither.ts
@@ -428,35 +428,35 @@ export const taskEitherSeq: typeof taskEither = {
 /**
  * @since 1.19.0
  */
-export function right2v<A>(a: A): TaskEither<never, A> {
+export function right2v<E = never, A = never>(a: A): TaskEither<E, A> {
   return new TaskEither(T.of(a))
 }
 
 /**
  * @since 1.19.0
  */
-export function left2v<L>(l: L): TaskEither<L, never> {
-  return fromEither(eitherLeft(l))
+export function left2v<E = never, A = never>(e: E): TaskEither<E, A> {
+  return fromEither(eitherLeft(e))
 }
 
 /**
  * @since 1.19.0
  */
-export function rightIO<A>(ma: IO<A>): TaskEither<never, A> {
+export function rightIO<E = never, A = never>(ma: IO<A>): TaskEither<E, A> {
   return rightTask(task.fromIO(ma))
 }
 
 /**
  * @since 1.19.0
  */
-export function leftIO<E>(me: IO<E>): TaskEither<E, never> {
+export function leftIO<E = never, A = never>(me: IO<E>): TaskEither<E, A> {
   return leftTask(task.fromIO(me))
 }
 
 /**
  * @since 1.19.0
  */
-export function rightTask<A>(ma: Task<A>): TaskEither<never, A> {
+export function rightTask<E = never, A = never>(ma: Task<A>): TaskEither<E, A> {
   // tslint:disable-next-line: deprecation
   return right(ma)
 }
@@ -464,7 +464,7 @@ export function rightTask<A>(ma: Task<A>): TaskEither<never, A> {
 /**
  * @since 1.19.0
  */
-export function leftTask<E>(me: Task<E>): TaskEither<E, never> {
+export function leftTask<E = never, A = never>(me: Task<E>): TaskEither<E, A> {
   // tslint:disable-next-line: deprecation
   return left(me)
 }
diff --git a/src/These.ts b/src/These.ts
index aae85e5f..4f8a61f9 100644
--- a/src/These.ts
+++ b/src/These.ts
@@ -452,13 +452,13 @@ export const these: Functor2<URI> & Bifunctor2<URI> & Foldable2v2<URI> & Travers
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const left: <E>(left: E) => These<E, never> = this_
+export const left: <E = never, A = never>(left: E) => These<E, A> = this_
 
 /**
  * @since 1.19.0
  */
 // tslint:disable-next-line: deprecation
-export const right: <A>(right: A) => These<never, A> = that
+export const right: <E = never, A = never>(right: A) => These<E, A> = that
 
 /**
  * Returns `true` if the these is an instance of `Left`, `false` otherwise


Test patch:
diff --git a/test/Const.ts b/test/Const.ts
index ecd3aee9..9c1203c9 100644
--- a/test/Const.ts
+++ b/test/Const.ts
@@ -1,5 +1,5 @@
 import * as assert from 'assert'
-import { Const, getApply, getEq, const_, getApplicative, getShow, make } from '../src/Const'
+import { getApply, getEq, const_, getApplicative, getShow, make } from '../src/Const'
 import { semigroupString } from '../src/Semigroup'
 import { eqNumber } from '../src/Eq'
 import { monoidString } from '../src/Monoid'
@@ -14,7 +14,7 @@ describe('Const', () => {
   })
 
   it('contramap', () => {
-    const fa: Const<string, number> = make('foo')
+    const fa = make<string, number>('foo')
     const double = (n: number): number => n * 2
     assert.strictEqual(fa.contramap(double), fa)
     assert.strictEqual(const_.contramap(fa, double), fa)
diff --git a/test/TaskEither.ts b/test/TaskEither.ts
index 1a1366e9..7eb14c18 100644
--- a/test/TaskEither.ts
+++ b/test/TaskEither.ts
@@ -178,7 +178,7 @@ describe('TaskEither', () => {
   it('getOrElse (method)', () => {
     const v: number = 42
     const te1 = right2v(1).getOrElse(v)
-    const te2 = (left2v('foo') as TaskEither<string, number>).getOrElse(v)
+    const te2 = left2v<string, number>('foo').getOrElse(v)
     return Promise.all([te1.run(), te2.run()]).then(([b1, b2]) => {
       assert.strictEqual(b1, 1)
       assert.strictEqual(b2, 42)
@@ -529,7 +529,7 @@ describe('TaskEither', () => {
         right2v(12),
         filterOrElse(isNumber, () => 'not a number')
       ),
-      (right2v(12) as TaskEither<string, number>).filterOrElseL(isNumber, () => 'not a number')
+      right2v<string, number>(12).filterOrElseL(isNumber, () => 'not a number')
     ]
     return Promise.all(tasks.map(te => te.run())).then(([r1, r2, r3, r4, r5, r6]) => {
       assert.deepStrictEqual(r1, eitherRight(12))