pfun
pfun copied to clipboard
Support generic types in lens
The lens mypy plugin hook currently doesn't work with generic types, eg in:
from typing import List
[0] | lens(List)[0] << 1 # error: Unsupported operand types for << ("Lens[List[_T], _T]" and "int")
One possible solution approach might be to add the type variable definitions and types of the generic type to the signature of __call__, __ror__, and __lshift__ of the Lens instance.