Add Tag type and hasTag function
This commit is contained in:
parent
b53558e2d1
commit
e220b7930c
@ -174,5 +174,11 @@ export const tryCatch = <A>(f: () => A): Either<A, Error> => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Tag<T> {
|
||||||
|
readonly _tag: T
|
||||||
|
}
|
||||||
|
|
||||||
|
export const hasTag = (x: string) => (y: Tag<string>) => x === y._tag
|
||||||
|
|
||||||
export const fromNullable = <A>(a: A | null | undefined): Option<A> =>
|
export const fromNullable = <A>(a: A | null | undefined): Option<A> =>
|
||||||
a == null ? none : some(a)
|
a == null ? none : some(a)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user