Closed
Description
For example, one may want to define a typeclass with type restriction, like this:
@typeclass
def map_(instance: Functor[T], function: Callable[[T], V] -> V:
...
So, when defining instances, we would have to watch for this contract.
This will typecheck:
@map_.instance(Maybe)
def map_(instance: Maybe[T], function: Callable[[T], V] -> V:
return instance.map(function)
But, this will not typecheck:
@map_.instance(int)
def map_(instance: int, function: Callable[[int], V] -> V:
return function(instance)
Metadata
Metadata
Assignees
Labels
No labels