Title: Track original names of quantified variables instantiated into unknowns · Issue #4256 · purescript/purescript · GitHub
Open Graph Title: Track original names of quantified variables instantiated into unknowns · Issue #4256 · purescript/purescript
X Title: Track original names of quantified variables instantiated into unknowns · Issue #4256 · purescript/purescript
Description: Summary The instantiatePolyTypeWithUnknowns routine in the type-checker turns universally quantified variables into unknowns. Keeping track of which variables are turned into which unknowns can help with better name generation once unkno...
Open Graph Description: Summary The instantiatePolyTypeWithUnknowns routine in the type-checker turns universally quantified variables into unknowns. Keeping track of which variables are turned into which unknowns can hel...
X Description: Summary The instantiatePolyTypeWithUnknowns routine in the type-checker turns universally quantified variables into unknowns. Keeping track of which variables are turned into which unknowns can hel...
Opengraph URL: https://github.com/purescript/purescript/issues/4256
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Track original names of quantified variables instantiated into unknowns","articleBody":"## Summary\r\n\r\nThe `instantiatePolyTypeWithUnknowns` routine in the type-checker turns universally quantified variables into unknowns. Keeping track of which variables are turned into which unknowns can help with better name generation once unknowns once generalization kicks in.\r\n\r\n## Motivation\r\n\r\nNames of quantified variables add helpful semantic information to consumers of some polymorphic function. However, it's particularly difficult to use them incrementally if this information gets erased. This small change should also help improve compiler warnings and errors; it'd be easier to change some type variable and code and see exactly which one is being pointed to by the error. \r\n\r\n## Proposal\r\n\r\nAdd another `Map` to `CheckState` which maps unknowns to their original names. During the generalization routine, check if an unknown has an entry in this map, if it does, use the unknown int as a suffix to the original name.\r\n\r\n## Examples\r\n\r\nFor example:\r\n```hs\r\nconst :: forall val dsc. val -> dsc -> val\r\nconst a _ = a\r\n\r\n-- const0 :: forall dsc1. dsc1 -> Int\r\nconst0 = const 0\r\n```","author":{"url":"https://github.com/purefunctor","@type":"Person","name":"purefunctor"},"datePublished":"2022-03-05T02:59:13Z","url":"https://github.com/purescript/purescript/issues/4256"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:18a503f6-1550-1ad2-2fc8-41e5ae92fe7b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A346:23CF06:B3A980:E8AE59:6B00E902 |
| html-safe-nonce | fc7bde04043ad0115059a5429e82dcfca39704363e72701e6d66612a22e39227 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzQ2OjIzQ0YwNjpCM0E5ODA6RThBRTU5OjZCMDBFOTAyIiwidmlzaXRvcl9pZCI6IjY0NzM3NDg2NjQ1Mzg5NDk4OTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 844a1300e5c3ad958de879e9ddd595950ab4f4843ca8bc217dc226ab08fbf7be |
| hovercard-subject-tag | issue:1160201343 |
| 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/purescript/purescript/4256/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fd0046df3f9e534b3b6a021109d0191999a44a2761243079483e7c04bce132c1/purescript/purescript/issues/4256 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fd0046df3f9e534b3b6a021109d0191999a44a2761243079483e7c04bce132c1/purescript/purescript/issues/4256 |
| og:image:alt | Summary The instantiatePolyTypeWithUnknowns routine in the type-checker turns universally quantified variables into unknowns. Keeping track of which variables are turned into which unknowns can hel... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | purefunctor |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript/purescript git https://github.com/purescript/purescript.git |
| octolytics-dimension-user_id | 6556677 |
| octolytics-dimension-user_login | purescript |
| octolytics-dimension-repository_id | 13206906 |
| octolytics-dimension-repository_nwo | purescript/purescript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 13206906 |
| octolytics-dimension-repository_network_root_nwo | purescript/purescript |
| 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 | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width