suned / pfun

Functional, composable, asynchronous, type-safe Python.

Home Page:https://pfun.dev/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Infer send type in generator function decorated with effect

suned opened this issue · comments

E.g

from pfun.maybe import with_effect, Maybe
from typing import Generator, Any, TypeVar

A = TypeVar('A')
Maybes = Generator[Maybe[Any], Any, A]
def g() -> Maybe[int]:
    ...

@with_effect
def f() -> Maybes[int]:
    a = yield g()
    reveal_type(a)  # should be int