Title: Annotation only required for function within let block · Issue #3922 · purescript/purescript · GitHub
Open Graph Title: Annotation only required for function within let block · Issue #3922 · purescript/purescript
X Title: Annotation only required for function within let block · Issue #3922 · purescript/purescript
Description: Description Some code fails to compile with an un-annotated function in a let block; however, the same code will compile if the un-annotated function is moved outside of the let block. To Reproduce map3 :: forall a b c d. (a -> b -> c ->...
Open Graph Description: Description Some code fails to compile with an un-annotated function in a let block; however, the same code will compile if the un-annotated function is moved outside of the let block. To Reproduce...
X Description: Description Some code fails to compile with an un-annotated function in a let block; however, the same code will compile if the un-annotated function is moved outside of the let block. To Reproduce...
Opengraph URL: https://github.com/purescript/purescript/issues/3922
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Annotation only required for function within let block","articleBody":"## Description\r\n\r\nSome code fails to compile with an un-annotated function in a `let` block; however, the same code _will_ compile if the un-annotated function is moved outside of the let block.\r\n\r\n## To Reproduce\r\n\r\n```purs\r\nmap3 :: forall a b c d. (a -> b -> c -> d) -> Array a -> Array b -> Array c -> Array d\r\nmap3 fn a b c =\r\n let\r\n -- Annotation is required if toZip is defined in let block\r\n --toZip :: forall x. Array x -> ZipList x\r\n toZip = ZipList \u003c\u003c\u003c LazyList.fromFoldable\r\n la = toZip a\r\n lb = toZip b\r\n lc = toZip c\r\n in\r\n Array.fromFoldable $ lift3 fn la lb lc\r\n\r\n-- It's fine to define without annotation globally\r\n--toZip = ZipList \u003c\u003c\u003c LazyList.fromFoldable\r\n```\r\nhttps://try.ps.ai/?gist=87e51987560be0007e7291699afcacd4\r\n\r\nThere is no compilation issue with an un-annotated `toZip` within a `let` block if it can be monomorphic throughout the `let` block. Thanks to @3ddyy for discovering this.\r\n```purs\r\n-- Annotation not required for ?monomorphic? toZip\r\nmap3mono :: forall a. (a -> a -> a -> a) -> Array a -> Array a -> Array a -> Array a\r\nmap3mono fn a b c =\r\n let\r\n toZip = ZipList \u003c\u003c\u003c LazyList.fromFoldable\r\n la = toZip a\r\n lb = toZip b\r\n lc = toZip c\r\n in\r\n Array.fromFoldable $ lift3 fn la lb lc\r\n```\r\n\r\n## Expected behavior\r\n\r\nI expect the version with an un-annotated `toZip` in the `let` block to compile.\r\n\r\n## PureScript version\r\n\r\n0.13.8\r\n","author":{"url":"https://github.com/milesfrain","@type":"Person","name":"milesfrain"},"datePublished":"2020-08-27T19:18:15Z","url":"https://github.com/purescript/purescript/issues/3922"}
| 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:d410470e-c1e2-868a-6a56-162799f17b87 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8450:3A0CC0:14D29E:1B6E85:6AFBB0D7 |
| html-safe-nonce | 5771ff314dc291af6faaad3cb34ff451c0b0cf374f93f127069bf6fcf751981a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NDUwOjNBMENDMDoxNEQyOUU6MUI2RTg1OjZBRkJCMEQ3IiwidmlzaXRvcl9pZCI6IjYzNDM1Nzk0NTAwMjEyMjg3NTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b282d2d34eb0a7a54fc4dfb8b6f8bdb9a3cab5a2177c784ae46303f4d5393226 |
| hovercard-subject-tag | issue:687480318 |
| 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/3922/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1d00f9369d95311768f5081f43586d1faf07374521e9c8f0469a28b77fc74318/purescript/purescript/issues/3922 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1d00f9369d95311768f5081f43586d1faf07374521e9c8f0469a28b77fc74318/purescript/purescript/issues/3922 |
| og:image:alt | Description Some code fails to compile with an un-annotated function in a let block; however, the same code will compile if the un-annotated function is moved outside of the let block. To Reproduce... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | milesfrain |
| hostname | github.com |
| expected-hostname | github.com |
| None | e25fbd830d3e6ad0e8935c105cf4fdc70c593dffcd27bb45b790ae4fece5ea55 |
| 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 | 08c8f17f9d27054a108b8b6254e405de0151f660 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width