Effect.map can't handle generators
suned opened this issue · comments
map
currently uses asyncio.iscoroutine
to determine if the result of a continuation function must be awaited. When a continuation returns a generator `asyncio.iscoroutine mistakes this generator for a coroutine:
from pfun import success
def f(_):
yield from [1, 2, 3]
success(0).map(f).run(None) # TypeError: object generator can't be used in 'await' expression