Add Tag type and hasTag function

This commit is contained in:
Eric Rumsey 2025-05-29 11:39:33 -05:00
parent b53558e2d1
commit e220b7930c

View File

@ -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> =>
a == null ? none : some(a)