Title: Declaring TH dependency in `.cabal` file · Issue #28 · Happstack/happstack-server · GitHub
Open Graph Title: Declaring TH dependency in `.cabal` file · Issue #28 · Happstack/happstack-server
X Title: Declaring TH dependency in `.cabal` file · Issue #28 · Happstack/happstack-server
Description: Currently, happstack has Flag template_haskell Description: Template Haskell is available on this system Default: True Manual: True ... Library: if (flag(template_haskell) && !(arch(arm))) Build-Depends: template-haskell cpp-options: -DT...
Open Graph Description: Currently, happstack has Flag template_haskell Description: Template Haskell is available on this system Default: True Manual: True ... Library: if (flag(template_haskell) && !(arch(arm))) Build-De...
X Description: Currently, happstack has Flag template_haskell Description: Template Haskell is available on this system Default: True Manual: True ... Library: if (flag(template_haskell) && !(arch(arm))) ...
Opengraph URL: https://github.com/Happstack/happstack-server/issues/28
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Declaring TH dependency in `.cabal` file","articleBody":"Currently, happstack has\n\n```\nFlag template_haskell\n Description: Template Haskell is available on this system\n Default: True\n Manual: True\n\n...\n\nLibrary:\n if (flag(template_haskell) \u0026\u0026 !(arch(arm)))\n Build-Depends: template-haskell\n cpp-options: -DTEMPLATE_HASKELL\n\n...\n\n Extensions: TemplateHaskell\n```\n\nThere's a couple of problems here (with cabal-1.24 \u0026 GHC 8.0)\n\nIf the TH-flag is set to false (or arch=arm), this package still won't build when GHC doesn't support TH, because then `extensions: TemplateHaskell` will still be in effect, and GHC will fail complaining it doesn't support TH.\n\nAnd with cabal-1.24, the solver will already exclude packages during solving where `extensions: TemplateHaskell` when GHC doesn't support that extension.\n\nMoreover, arch(arm) is not the only platform lacking TH support. However, since cabal knows when your environment supports TH, you should let cabal decide.\n\nConsequently, I suggest the following definitions instead: \n\nUse an automatic flag for declaring TH support, and make sure this flag doesn't have any other pressure applied other than `other-extensions: TemplateHaskell` or `default-extensions: TemplateHaskell`, i.e.\n\n```\nFlag template_haskell\n Description: Template Haskell is available on this system\n Default: True\n Manual: False\n\nLibrary:\n -- the TH library is available even in environments lacking -XTemplateHaskell support\n -- placing this outside the conditional allows adding upper bounds after-the-fact on hackage w/o adding solver-pressure to the flag\n Build-Depends: template-haskell\n if flag(template_haskell)\n cpp-options: -DTEMPLATE_HASKELL\n -- other-extensions doesn't enable the extension; this only declares which LANGUAGE pragmas may be used\n other-extensions: TemplateHaskell\n```\n\nthis will cause cabal (starting with 1.24) to set the `template_haskell` flag depending on whether the compiler supports TH.\n\n/cc @bergmark @phadej\n","author":{"url":"https://github.com/hvr","@type":"Person","name":"hvr"},"datePublished":"2016-06-10T11:56:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/28/happstack-server/issues/28"}
| 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:8615544b-1db3-5007-d90e-16bbbe4d07b1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A7AE:205885:1E556:2889B:6A4D7F2F |
| html-safe-nonce | 89a9c85436652a7b35737c778b1ee56d0cf5694fa1c79018868a2afee2c15d8d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0FFOjIwNTg4NToxRTU1NjoyODg5Qjo2QTREN0YyRiIsInZpc2l0b3JfaWQiOiI3NDUxMTI2MDQ2NzY4NTk0NzM1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ea74b264bef6db860647898adb08a58c7c8b02152660a119823bd83e47861d6a |
| hovercard-subject-tag | issue:159619395 |
| 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/Happstack/happstack-server/28/issue_layout |
| twitter:image | https://opengraph.githubassets.com/49173315b89cb886525008f77a9da92581852e22a322c3cb3575188e864e8326/Happstack/happstack-server/issues/28 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/49173315b89cb886525008f77a9da92581852e22a322c3cb3575188e864e8326/Happstack/happstack-server/issues/28 |
| og:image:alt | Currently, happstack has Flag template_haskell Description: Template Haskell is available on this system Default: True Manual: True ... Library: if (flag(template_haskell) && !(arch(arm))) Build-De... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hvr |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6bf61c909482ec3072ef5d7a5a28f2a9d214788c9a44793eca1960048cb05ae |
| turbo-cache-control | no-preview |
| go-import | github.com/Happstack/happstack-server git https://github.com/Happstack/happstack-server.git |
| octolytics-dimension-user_id | 1452068 |
| octolytics-dimension-user_login | Happstack |
| octolytics-dimension-repository_id | 28725423 |
| octolytics-dimension-repository_nwo | Happstack/happstack-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 28725423 |
| octolytics-dimension-repository_network_root_nwo | Happstack/happstack-server |
| 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 | 6702a58b419a792226bd21ef0fb1bcb318bbcaa3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width