pfun icon indicating copy to clipboard operation
pfun copied to clipboard

Support generic types in lens

Open suned opened this issue 4 years ago • 0 comments

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.

suned avatar Jun 15 '21 10:06 suned