We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
The function signature for Either altW is as follows:
Either
altW
export declare const altW: <E2, B>(that: Lazy<Either<E2, B>>) => <E1, A>(fa: Either<E1, A>) => Either<E1 | E2, A | B>
From my understanding of alt, Left<E1> can never be produced, so I believe the signature should be as follows:
alt
Left<E1>
export declare const altW: <E2, B>(that: Lazy<Either<E2, B>>) => <E1, A>(fa: Either<E1, A>) => Either<E2, A | B>
const foo = pipe( E.left<number, number>(1), E.altW(() => E.right<string, string>('a')), );
In this case, foo's type is Either<string | number, string | number>.
foo
Either<string | number, string | number>
I believe foo's type should be Either<string, string | number>.
Either<string, string | number>
See above.
Remove E1 from the return type of altW:
export const altW: <E2, B>( that: Lazy<Either<E2, B>>, ) => <E1, A>(fa: Either<E1, A>) => Either<E2, A | B> = that => fa => (isLeft(fa) ? that() : fa);
I could make a PR if you agree.
The text was updated successfully, but these errors were encountered:
@wmaurer thanks, you are right the current error type is overspecified. Looks like the following data types suffer from the same issue:
Sorry, something went wrong.
Great, thanks for the confirmation. I'll put together a PR soon.
Successfully merging a pull request may close this issue.
馃悰 Bug report
The function signature for
Either
altW
is as follows:From my understanding of
alt
,Left<E1>
can never be produced, so I believe the signature should be as follows:Current Behavior
In this case,
foo
's type isEither<string | number, string | number>
.Expected behavior
I believe
foo
's type should beEither<string, string | number>
.Reproducible example
See above.
Suggested solution(s)
Remove E1 from the return type of
altW
:I could make a PR if you agree.
Your environment
The text was updated successfully, but these errors were encountered: