Skip to content
New issue

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Either.bind method doesn't support type hint as well #35

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

fResult
Copy link

@fResult fResult commented Mar 14, 2024

Related issue: Either.bind function doesn't support type hint as well #34.

If there is anything improper, please don't hesitate to give me suggestions. 😉

@fResult fResult force-pushed the fix-bind-method-type-signature-doesnt-correctly-give-type-hint branch from 6b0c008 to 22be46e Compare March 14, 2024 18:39
def bind(
self: 'Either[M, S]', kleisli_function: Callable[[S], 'Either[M, T]']
) -> 'Either[M, T]':
def bind[Err, Val](

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you defined Err and Val in a previous PR, this will likely break the typing. S and T are referenced via TypeVar. Err and Val are not.
Also, you need to consider backward compatibility, this way of defining generics isn't supported earlier than python 3.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants