Title: Move values from where out of function where possible · Issue #496 · purescript/purescript · GitHub
Open Graph Title: Move values from where out of function where possible · Issue #496 · purescript/purescript
X Title: Move values from where out of function where possible · Issue #496 · purescript/purescript
Description: When there's a definition like: parseJSON :: forall a. (ReadForeign a) => String -> Either String a parseJSON json = fromString json >>= parseForeign read where fromString :: String -> Either String Foreign fromString = runFn3 fromString...
Open Graph Description: When there's a definition like: parseJSON :: forall a. (ReadForeign a) => String -> Either String a parseJSON json = fromString json >>= parseForeign read where fromString :: String -> Either Strin...
X Description: When there's a definition like: parseJSON :: forall a. (ReadForeign a) => String -> Either String a parseJSON json = fromString json >>= parseForeign read where fromString :: String...
Opengraph URL: https://github.com/purescript/purescript/issues/496
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Move values from where out of function where possible","articleBody":"When there's a definition like:\n\n``` haskell\nparseJSON :: forall a. (ReadForeign a) => String -> Either String a\nparseJSON json = fromString json >>= parseForeign read\n where\n fromString :: String -> Either String Foreign\n fromString = runFn3 fromStringImpl Left Right\n```\n\nAs fromString doesn't use any variables introduced by parseJSON it can be treated as:\n\n``` haskell\nparseJSON :: forall a. (ReadForeign a) => String -> Either String a\nparseJSON json = fromString json >>= parseForeign read\n\nfromString :: String -> Either String Foreign\nfromString = runFn3 fromStringImpl Left Right\n```\n\nAs otherwise, in the generated JS, whenever `parseJSON` is called you also have to pay for the creation of `fromString` every time:\n\n``` js\nvar parseJSON = function (__dict_ReadForeign_0) {\n return function (json) {\n var fromString = Data_Function.runFn3(fromStringImpl)(Data_Either.Left.create)(Data_Either.Right.create);\n return Prelude[\">>=\"](Data_Either.bindEither({}))(fromString(json))(parseForeign(read(__dict_ReadForeign_0)));\n };\n};\n```\n\nThis applies anywhere a `let` or `where` introduces a function \"later\" than it needs to, just need to make sure that when moving `fromString` up its name doesn't conflict with another declaration in the scope it is moved to.\n","author":{"url":"https://github.com/garyb","@type":"Person","name":"garyb"},"datePublished":"2014-07-20T13:46:09Z","url":"https://github.com/purescript/purescript/issues/496"}
| 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:f53903f4-ab22-11e7-76d9-acfc7cf68cd3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DCBE:11486D:8B532E:B65969:6B00DE1E |
| html-safe-nonce | 1e8e79db1b4c720734d73cf67315deef814f70186165f185303bacb313a1ad9e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0JFOjExNDg2RDo4QjUzMkU6QjY1OTY5OjZCMDBERTFFIiwidmlzaXRvcl9pZCI6IjI4MzgxNzA1OTkyMjkwMjE3MjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 06dd1cee86ae885366b5cefb0dd99fcb43fd3a343f92bd6f58a618667f182ddb |
| hovercard-subject-tag | issue:38257909 |
| 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/496/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1b3d558b1a504fbc822019f70db662b75d9b3bcf8d9751ba7b6bc854ceef206f/purescript/purescript/issues/496 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1b3d558b1a504fbc822019f70db662b75d9b3bcf8d9751ba7b6bc854ceef206f/purescript/purescript/issues/496 |
| og:image:alt | When there's a definition like: parseJSON :: forall a. (ReadForeign a) => String -> Either String a parseJSON json = fromString json >>= parseForeign read where fromString :: String -> Either Strin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | garyb |
| hostname | github.com |
| expected-hostname | github.com |
| None | 043c3f30fbcbe2c6c8e729e10cbbbc90c406546f9fbbb67c648d38f6b7d16daf |
| 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 | 5425dc24e8bd8d6fca9641a12afc984825a43875 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width