Open sobolevn opened 4 years ago
@Functor.instance
class Maybe(Generic[T]):
def map(self, function: Callable[[T], Maybe[V]]) -> Maybe[V]:
...
@classmethod
def from_value(cls, inner_value: V) -> Maybe[V]:
...
How is it different from a simple protocol?
There's a common use-case when we need to create a type-class with several methods. Like:
Currently, there's no way we can do that.
I propose something like this:
I am not sure how to bound it to the actual implementation.