Skip to content

Commit

Permalink
Use TypeVarTuple for HKT utils definion
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Jul 28, 2024
1 parent 1a29e55 commit 92042b8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions returns/primitives/hkt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import TYPE_CHECKING, Any, Callable, Generic, Protocol, TypeVar
from typing import TYPE_CHECKING, Any, Callable, Protocol, TypeVar

from typing_extensions import Never
from typing_extensions import Never, TypeVarTuple, Generic

_InstanceType = TypeVar('_InstanceType', covariant=True)
_TypeArgType1 = TypeVar('_TypeArgType1', covariant=True)
Expand All @@ -22,10 +22,10 @@
_FirstKind = TypeVar('_FirstKind')
_SecondKind = TypeVar('_SecondKind')

_TypeVars = TypeVarTuple('_TypeVars')

class KindN(
Generic[_InstanceType, _TypeArgType1, _TypeArgType2, _TypeArgType3],
):

class KindN(Generic[_InstanceType, *_TypeVars]):
"""
Emulation support for Higher Kinded Types.
Expand Down Expand Up @@ -109,9 +109,7 @@ def __getattr__(self, attrname: str):
Kind3 = KindN[_InstanceType, _TypeArgType1, _TypeArgType2, _TypeArgType3]


class SupportsKindN(
KindN[_InstanceType, _TypeArgType1, _TypeArgType2, _TypeArgType3],
):
class SupportsKindN(KindN[_InstanceType, *_TypeVars]):
"""
Base class for your containers.
Expand Down

0 comments on commit 92042b8

Please sign in to comment.