aka type constructors, generic TypeVars
Has there already been discussion about those?
I do a lot of FP that results in impossible situations because of this. Consider an example:
A = TypeVar('A') B = TypeVar('B') F = TypeVar('F') class M(Generic[F[X], A]): def x(fa: F[A], f: Callable[[A], B]) -> F[B]: return map(f, fa) M().x([1], str)
I haven't found a way to make this work, does anyone know a trick or is it impossible?
If not, consider the syntax as a proposal.
Reference implementations would be Haskell, Scala.
optimally, the HK's type param would be indexable as well, allowing for F[X[X, X], X[X]]
Summary of current status (by @smheidrich, 2024-02-08):
peps
repo. The stub PEP draft so far contains a few examples of the proposed syntax.thautwarm, mredaelli, grayfall, harveywi, maxfischer2781 and 340 moreschneiderfelipe, harahu, randolf-scholz, griels, ssaavedra and 9 morethautwarm, bwo, RHDZMOTA, ksonj, superChing and 66 morerscarrera27, benoit-dubreuil, purefunctor, MagicalLas, hartror and 20 morephyrwork, purefunctor, schneiderfelipe, AlexWaygood, harahu and 14 more
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4