{"id":17248905,"url":"https://github.com/serras/liquid-nats-plugins-example","last_synced_at":"2025-03-26T06:14:18.210Z","repository":{"id":140294709,"uuid":"290688491","full_name":"serras/liquid-nats-plugins-example","owner":"serras","description":"Example project using LiquidHaskell and Natural Normalisation plug-ins","archived":false,"fork":false,"pushed_at":"2020-08-27T06:06:57.000Z","size":5,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T07:41:41.477Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serras.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-27T05:52:26.000Z","updated_at":"2020-08-29T00:20:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9c36bda-43c5-4fe9-8eec-3f7e47bce8e0","html_url":"https://github.com/serras/liquid-nats-plugins-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serras%2Fliquid-nats-plugins-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serras%2Fliquid-nats-plugins-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serras%2Fliquid-nats-plugins-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serras%2Fliquid-nats-plugins-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serras","download_url":"https://codeload.github.com/serras/liquid-nats-plugins-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245598315,"owners_count":20641884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T06:42:25.180Z","updated_at":"2025-03-26T06:14:18.182Z","avatar_url":"https://github.com/serras.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example repo using GHC plug-ins\n## LiquidHaskell and Natural Normalisation\n\nIn this repo you can find implementations of lists-that-track-their-length\nusing [GADTs](https://github.com/serras/liquid-nats-plugins-example/blob/master/src/gadt/Example.hs)\nand [LiquidHaskell](https://github.com/serras/liquid-nats-plugins-example/blob/master/src/liquid/Example.hs).\nIn both cases, they need GHC plug-ins to be enabled for the code to compile:\n\n- The GADT-based version requires [Natural Normalisation](http://hackage.haskell.org/package/ghc-typelits-natnormalise)\n  for the `gAppend` implementation to be accepted. Otherwise you need to resort\n  to manually encoding natural numbers and proving equalities \"by hand\".\n- The LiquidHaskell version uses its [integration as plug-in](https://ucsd-progsys.github.io/liquidhaskell-blog/2020/08/20/lh-as-a-ghc-plugin.lhs/) available since\n  version 0.8.10.2.\n\n## The important bits\n\nThe [Cabal file](https://github.com/serras/liquid-nats-plugins-example/blob/master/talk-gadts-lh.cabal)\nis the place where plug-ins must be enabled. If you are using Stack, you also\nneed to add the LiquidHaskell packages to the [`stack.yaml`](https://github.com/serras/liquid-nats-plugins-example/blob/master/stack.yaml)\nfile (and currently only the `nightly` resolver ships with a compatible\nversion of GHC).\n\nRegardless of the plug-in you want to enable, you need to change:\n\n- The `build-depends` field, to ask for the corresponding plug-in as a dependency.\n  - Natural Normalisation requires `ghc-typelits-natnormalise` only,\n  - LiquidHaskell needs `liquidhaskell` and additionally wrapper libraries which\n    include refined type information. Almost always you want to replace `base`\n    from that field with `liquid-base`.\n- The `ghc-options` field, to enable the plug-in at compile time.\n  - For Natural Normalisation use `-fplugin=GHC.TypeLits.Normalise`.\n  - For LiquidHaskell use `-fplugin=LiquidHaskell`. In this case I also recommend\n    to _disable_ the \"incomplete patterns\" warning, since you may get false\n    positives (in fact, we do in this example).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserras%2Fliquid-nats-plugins-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserras%2Fliquid-nats-plugins-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserras%2Fliquid-nats-plugins-example/lists"}