Title: Higher-Kinded TypeVars · Issue #548 · python/typing · GitHub
Open Graph Title: Higher-Kinded TypeVars · Issue #548 · python/typing
X Title: Higher-Kinded TypeVars · Issue #548 · python/typing
Description: 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 ...
Open Graph Description: 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') ...
X Description: 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('...
Opengraph URL: https://github.com/python/typing/issues/548
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Higher-Kinded TypeVars","articleBody":"aka type constructors, generic TypeVars\r\n\r\nHas there already been discussion about those?\r\nI do a lot of FP that results in impossible situations because of this. Consider an example:\r\n\r\n```python\r\nA = TypeVar('A')\r\nB = TypeVar('B')\r\nF = TypeVar('F')\r\n\r\nclass M(Generic[F[X], A]):\r\n def x(fa: F[A], f: Callable[[A], B]) -\u003e F[B]:\r\n return map(f, fa)\r\n\r\nM().x([1], str)\r\n```\r\n\r\nI haven't found a way to make this work, does anyone know a trick or is it impossible?\r\nIf not, consider the syntax as a proposal.\r\nReference implementations would be Haskell, Scala.\r\noptimally, the HK's type param would be indexable as well, allowing for `F[X[X, X], X[X]]`\r\n\r\n----\r\n\r\nSummary of current status (by @smheidrich, 2024-02-08):\r\n\r\n- @JelleZijlstra [has indicated interest](https://github.com/python/typing/issues/548#issuecomment-1193345123) in sponsoring a PEP, conditional on a prototype implementation in a major type checker and a well-specified draft PEP.\r\n- Drafting the PEP takes place in @nekitdev's [fork](https://github.com/nekitdev/peps) of the `peps` repo. The [**stub PEP draft**](https://github.com/nekitdev/peps/blob/main/pep-9999.rst) so far contains a few examples of the proposed syntax.\r\n- That same repo's [**GitHub Discussions forum**](https://github.com/nekitdev/peps/discussions) forum has been [designated](https://github.com/python/typing/issues/548#issuecomment-1193348994) as the place to discuss the PEP (and presumably the prototype implementation?). Some limited further discussions have taken place there.\r\n - If you want to be notified of new discussion threads, I think you have to set the whole repo as \"watched\" in GitHub?\r\n","author":{"url":"https://github.com/tek","@type":"Person","name":"tek"},"datePublished":"2018-03-30T22:56:19.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":222},"url":"https://github.com/548/typing/issues/548"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ab98c6b0-9d7f-9629-f02c-c8aead7a887d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C062:D76E7:A63BFD:E3DF9E:6A62F14A |
| html-safe-nonce | 28b73a03313237e0a747afb7d0db8a8c336dedf92c60c650fab6e23979a87d70 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDYyOkQ3NkU3OkE2M0JGRDpFM0RGOUU6NkE2MkYxNEEiLCJ2aXNpdG9yX2lkIjoiNTAwMTI1ODQwNzc0OTg0MDEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d246599428d2e714433bdf497e60409161441647e9a226eaa602480e6965387d |
| hovercard-subject-tag | issue:310187277 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typing/548/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ecd14f8013a457546c1f7cc1a363d43052ed605994cebac2b44c472bda008a2d/python/typing/issues/548 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ecd14f8013a457546c1f7cc1a363d43052ed605994cebac2b44c472bda008a2d/python/typing/issues/548 |
| og:image:alt | 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') ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tek |
| hostname | github.com |
| expected-hostname | github.com |
| None | b415018e190e73858133ddcaa36acce7b3f3572fe54dda84bd3b21a6ec714c30 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typing git https://github.com/python/typing.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 24604008 |
| octolytics-dimension-repository_nwo | python/typing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24604008 |
| octolytics-dimension-repository_network_root_nwo | python/typing |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 22f98521e99f504294ab0812b66104d50eb75a70 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width