Skip to content

Commit ac9f64b

Browse files
authored
Update generics.rst
1 parent b6e45ae commit ac9f64b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/pages/generics.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ match the shape of the typeclass itself:
2727
>>> X = TypeVar('X')
2828
2929
>>> @typeclass
30-
... def is_equal(first: X, second: X) -> bool:
30+
... def copy(instance: X) -> X:
3131
... ...
3232
3333
This one will typecheck correctly:
3434

3535
.. code:: python
3636
37-
>>> @is_equal.instance(int)
38-
... def _is_equal_int(first: int, second: int) -> bool:
37+
>>> @copy.instance(int)
38+
... def _copy_int(instance: int) -> int:
3939
... ...
4040
4141
But, this won't:
4242

4343
.. code:: python
4444
45-
@is_equal.instance(str)
46-
def _is_equal_str(first: str, second: float) -> bool:
45+
@copy.instance(str)
46+
def _copy_str(instance: str) -> bool:
4747
...
4848
4949
# error: Instance callback is incompatible "def (first: builtins.str, second: builtins.float) -> builtins.bool"; expected "def (first: builtins.str, second: builtins.str*) -> builtins.bool"

0 commit comments

Comments
 (0)