Skip to content

Commit

Permalink
fix MonadTask definition
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti committed Jun 17, 2019
1 parent a32e09e commit dc24ef2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 41 deletions.
10 changes: 5 additions & 5 deletions docs/modules/MonadTask.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Lift a computation from the `Task` monad
**Signature**

```ts
export interface MonadTask<M> extends Monad<M> {
export interface MonadTask<M> extends MonadIO<M> {
readonly fromTask: <A>(fa: Task<A>) => HKT<M, A>
}
```
Expand All @@ -37,7 +37,7 @@ Added in v2.0.0
**Signature**

```ts
export interface MonadTask1<M extends URIS> extends Monad1<M> {
export interface MonadTask1<M extends URIS> extends MonadIO1<M> {
readonly fromTask: <A>(fa: Task<A>) => Kind<M, A>
}
```
Expand All @@ -49,7 +49,7 @@ Added in v2.0.0
**Signature**

```ts
export interface MonadTask2<M extends URIS2> extends Monad2<M> {
export interface MonadTask2<M extends URIS2> extends MonadIO2<M> {
readonly fromTask: <E, A>(fa: Task<A>) => Kind2<M, E, A>
}
```
Expand All @@ -61,7 +61,7 @@ Added in v2.0.0
**Signature**

```ts
export interface MonadTask2C<M extends URIS2, E> extends Monad2C<M, E> {
export interface MonadTask2C<M extends URIS2, E> extends MonadIO2C<M, E> {
readonly fromTask: <A>(fa: Task<A>) => Kind2<M, E, A>
}
```
Expand All @@ -73,7 +73,7 @@ Added in v2.0.0
**Signature**

```ts
export interface MonadTask3<M extends URIS3> extends Monad3<M> {
export interface MonadTask3<M extends URIS3> extends MonadIO3<M> {
readonly fromTask: <R, E, A>(fa: Task<A>) => Kind3<M, R, E, A>
}
```
Expand Down
7 changes: 1 addition & 6 deletions docs/modules/ReaderTaskEither.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,7 @@ Added in v2.0.0
**Signature**

```ts
export const readerTaskEither: Monad3<URI> &
Bifunctor3<URI> &
Alt3<URI> &
MonadIO3<URI> &
MonadTask3<URI> &
MonadThrow3<URI> = ...
export const readerTaskEither: Monad3<URI> & Bifunctor3<URI> & Alt3<URI> & MonadTask3<URI> & MonadThrow3<URI> = ...
```

Added in v2.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/Task.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Added in v2.0.0
**Signature**

```ts
export const task: Monad1<URI> & MonadIO1<URI> & MonadTask1<URI> = ...
export const task: Monad1<URI> & MonadTask1<URI> = ...
```

Added in v2.0.0
Expand Down
7 changes: 1 addition & 6 deletions docs/modules/TaskEither.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,7 @@ Added in v2.0.0
**Signature**

```ts
export const taskEither: Monad2<URI> &
Bifunctor2<URI> &
Alt2<URI> &
MonadIO2<URI> &
MonadTask2<URI> &
MonadThrow2<URI> = ...
export const taskEither: Monad2<URI> & Bifunctor2<URI> & Alt2<URI> & MonadTask2<URI> & MonadThrow2<URI> = ...
```

Added in v2.0.0
Expand Down
12 changes: 6 additions & 6 deletions src/MonadTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,40 @@
* @file Lift a computation from the `Task` monad
*/
import { HKT, Kind, Kind2, Kind3, URIS, URIS2, URIS3 } from './HKT'
import { Monad, Monad1, Monad2, Monad2C, Monad3 } from './Monad'
import { MonadIO, MonadIO1, MonadIO2, MonadIO2C, MonadIO3 } from './MonadIO'
import { Task } from './Task'

/**
* @since 2.0.0
*/
export interface MonadTask<M> extends Monad<M> {
export interface MonadTask<M> extends MonadIO<M> {
readonly fromTask: <A>(fa: Task<A>) => HKT<M, A>
}

/**
* @since 2.0.0
*/
export interface MonadTask1<M extends URIS> extends Monad1<M> {
export interface MonadTask1<M extends URIS> extends MonadIO1<M> {
readonly fromTask: <A>(fa: Task<A>) => Kind<M, A>
}

/**
* @since 2.0.0
*/
export interface MonadTask2<M extends URIS2> extends Monad2<M> {
export interface MonadTask2<M extends URIS2> extends MonadIO2<M> {
readonly fromTask: <E, A>(fa: Task<A>) => Kind2<M, E, A>
}

/**
* @since 2.0.0
*/
export interface MonadTask2C<M extends URIS2, E> extends Monad2C<M, E> {
export interface MonadTask2C<M extends URIS2, E> extends MonadIO2C<M, E> {
readonly fromTask: <A>(fa: Task<A>) => Kind2<M, E, A>
}

/**
* @since 2.0.0
*/
export interface MonadTask3<M extends URIS3> extends Monad3<M> {
export interface MonadTask3<M extends URIS3> extends MonadIO3<M> {
readonly fromTask: <R, E, A>(fa: Task<A>) => Kind3<M, R, E, A>
}
8 changes: 1 addition & 7 deletions src/ReaderTaskEither.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Either } from './Either'
import { IO } from './IO'
import { IOEither } from './IOEither'
import { Monad3 } from './Monad'
import { MonadIO3 } from './MonadIO'
import { MonadTask3 } from './MonadTask'
import { MonadThrow3 } from './MonadThrow'
import { Monoid } from './Monoid'
Expand Down Expand Up @@ -204,12 +203,7 @@ export function local<Q, R>(f: (f: Q) => R): <E, A>(ma: ReaderTaskEither<R, E, A
/**
* @since 2.0.0
*/
export const readerTaskEither: Monad3<URI> &
Bifunctor3<URI> &
Alt3<URI> &
MonadIO3<URI> &
MonadTask3<URI> &
MonadThrow3<URI> = {
export const readerTaskEither: Monad3<URI> & Bifunctor3<URI> & Alt3<URI> & MonadTask3<URI> & MonadThrow3<URI> = {
URI,
map: T.map,
of: right,
Expand Down
5 changes: 2 additions & 3 deletions src/Task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
*/
import { IO } from './IO'
import { Monad1 } from './Monad'
import { MonadIO1 } from './MonadIO'
import { MonadTask1 } from './MonadTask'
import { Monoid } from './Monoid'
import { Semigroup } from './Semigroup'
import { pipeable } from './pipeable'
import { Semigroup } from './Semigroup'

declare module './HKT' {
interface URItoKind<A> {
Expand Down Expand Up @@ -116,7 +115,7 @@ export function of<A>(a: A): Task<A> {
/**
* @since 2.0.0
*/
export const task: Monad1<URI> & MonadIO1<URI> & MonadTask1<URI> = {
export const task: Monad1<URI> & MonadTask1<URI> = {
URI,
map: (ma, f) => () => ma().then(f),
of,
Expand Down
8 changes: 1 addition & 7 deletions src/TaskEither.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Lazy } from './function'
import { IO } from './IO'
import { IOEither } from './IOEither'
import { Monad2, Monad2C } from './Monad'
import { MonadIO2 } from './MonadIO'
import { MonadTask2 } from './MonadTask'
import { MonadThrow2 } from './MonadThrow'
import { Monoid } from './Monoid'
Expand Down Expand Up @@ -232,12 +231,7 @@ export function getTaskValidation<E>(S: Semigroup<E>): Monad2C<URI, E> & Alt2C<U
/**
* @since 2.0.0
*/
export const taskEither: Monad2<URI> &
Bifunctor2<URI> &
Alt2<URI> &
MonadIO2<URI> &
MonadTask2<URI> &
MonadThrow2<URI> = {
export const taskEither: Monad2<URI> & Bifunctor2<URI> & Alt2<URI> & MonadTask2<URI> & MonadThrow2<URI> = {
URI,
bimap: T.bimap,
mapLeft: T.mapLeft,
Expand Down

0 comments on commit dc24ef2

Please sign in to comment.