returns icon indicating copy to clipboard operation
returns copied to clipboard

Kind of Kind

Open horta opened this issue 4 years ago • 4 comments

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]]. kind

System information

  • python version: Python 3.9.1
  • returns version: master:1fec2a8a79175da5afa39695e3ccc177c8c73ab7
  • mypy version: mypy 0.800

horta avatar Feb 10 '21 17:02 horta

I have just tried

kind2

Was that supposed to work?

horta avatar Feb 10 '21 17:02 horta

Nested kinds are not supported at the moment 😢

sobolevn avatar Feb 10 '21 19:02 sobolevn

I figured. This is an improvement then but I wonder if it is worth the work.

horta avatar Feb 10 '21 23:02 horta

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.

sobolevn avatar Feb 11 '21 09:02 sobolevn