-
-
Notifications
You must be signed in to change notification settings - Fork 30
Consider adding generics support #8
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed