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.
We need to be able to work with generic like
List[str]orResult[str, Exception]andMaybe[int]I propose the following API:
It should be supported on both side: types and runtime.