Closed
Description
We need to be able to work with generic like List[str]
or Result[str, Exception]
and Maybe[int]
I propose the following API:
@typeclass
def test(instance) -> int:
...
@test.instance(
Some[int],
predicate=lambda instance: is_successful(instance) and isinstance(instance.unwrap(), int),
)
def _test_success_int(instance: Some[int]) -> int:
return instance.unwrap()
It should be supported on both side: types and runtime.