Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
cevr committed May 19, 2023
1 parent ad188a4 commit 9e1364d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { None, Option, Some } from "./option";
import { Err, Ok, Result } from "./result";
import { AsyncTask, SyncTask, Task } from "./task";
import { Task } from "./task";

export function identity<A>(a: A): A {
return a;
Expand All @@ -14,18 +14,12 @@ export function isOption<A>(value: unknown): value is Option<A> {
return value instanceof Some || value instanceof None;
}

export function isTask<E, A>(
value: unknown
): value is AsyncTask<E, A> | SyncTask<E, A> {
export function isTask<E, A>(value: unknown): value is Task<E, A> {
return value instanceof Task;
}

export function isMonad(value: unknown): value is Monad<unknown, unknown> {
return isOption(value) || isResult(value) || isTask(value);
}

export type Monad<E, A> =
| Option<A>
| Result<E, A>
| AsyncTask<E, A>
| SyncTask<E, A>;
export type Monad<E, A> = Option<A> | Result<E, A> | Task<E, A>;

0 comments on commit 9e1364d

Please sign in to comment.