returns
returns copied to clipboard
Kind of Kind
Bug report
What's wrong
I would like to do
from __future__ import annotations
from typing import TypeVar
from returns.primitives.hkt import Kind1, Kind2
class Alphabet:
pass
_A = TypeVar("_A", bound=Alphabet)
class State(Kind1["State", _A]):
pass
_S = TypeVar("_S", bound=State)
class Step(Kind2["Step", _A, _S]):
def foo(self, step: Step[_A, Kind1[_S, _A]]): # mypy error
del step
del self
pass
Such that the step parameter of Step.foo has the type-hint Step[_A, _S[_A]].

System information
pythonversion: Python 3.9.1returnsversion: master:1fec2a8a79175da5afa39695e3ccc177c8c73ab7mypyversion: mypy 0.800
I have just tried
Was that supposed to work?
Nested kinds are not supported at the moment 😢
I figured. This is an improvement then but I wonder if it is worth the work.
I have some use-cases when this would be a good thing to have. It really depends on how much time / effort / hacks are required to make it work.