{"id":17993509,"url":"https://github.com/chshersh/ghc-plugin-non-empty","last_synced_at":"2025-07-10T16:04:10.356Z","repository":{"id":45848818,"uuid":"487570344","full_name":"chshersh/ghc-plugin-non-empty","owner":"chshersh","description":"🧬 GHC Plugin for compile-time transformation of list literals to NonEmpty list","archived":false,"fork":false,"pushed_at":"2023-01-11T19:13:52.000Z","size":33,"stargazers_count":27,"open_issues_count":4,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-04T06:03:49.423Z","etag":null,"topics":["compile-time","ghc","haskell","plugin"],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/ghc-plugin-non-empty","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chshersh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":"FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":["chshersh"]}},"created_at":"2022-05-01T15:19:07.000Z","updated_at":"2024-07-30T23:38:49.000Z","dependencies_parsed_at":"2023-02-09T04:31:34.150Z","dependency_job_id":null,"html_url":"https://github.com/chshersh/ghc-plugin-non-empty","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/chshersh/ghc-plugin-non-empty","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fghc-plugin-non-empty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fghc-plugin-non-empty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fghc-plugin-non-empty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fghc-plugin-non-empty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chshersh","download_url":"https://codeload.github.com/chshersh/ghc-plugin-non-empty/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chshersh%2Fghc-plugin-non-empty/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264604398,"owners_count":23635861,"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":["compile-time","ghc","haskell","plugin"],"created_at":"2024-10-29T20:11:45.189Z","updated_at":"2025-07-10T16:04:10.305Z","avatar_url":"https://github.com/chshersh.png","language":"Haskell","funding_links":["https://github.com/sponsors/chshersh"],"categories":[],"sub_categories":[],"readme":"# ghc-plugin-non-empty\n\n[![GitHub CI](https://github.com/chshersh/ghc-plugin-non-empty/workflows/CI/badge.svg)](https://github.com/chshersh/ghc-plugin-non-empty/actions)\n[![Hackage](https://img.shields.io/hackage/v/ghc-plugin-non-empty.svg?logo=haskell)](https://hackage.haskell.org/package/ghc-plugin-non-empty)\n[![MPL-2.0 license](https://img.shields.io/badge/license-MPL--2.0-blue.svg)](LICENSE)\n\nGHC Compiler Plugin for automatically converting list literals to the\n`NonEmpty` type from the `Data.List.NonEmpty` module in `base`.\n\nThis plugin checks statically defined list literals and transforms\nthem into `NonEmpty` lists during compile time. In other words, it\nprovides compile-time guarantees for non-emptiness checks and allows\nthe following expression to type-check:\n\n```haskell\nportsToListen :: NonEmpty Int\nportsToListen = [8000, 8080, 8081]\n```\n\nCompare to usage without the plugin:\n\n```haskell\nportsToListen :: NonEmpty Int\nportsToListen = 8000 :| [8080, 8081]\n```\n\n\u003e ℹ️ **DISCLAIMER:** `ghc-plugin-non-empty` is developed and\n\u003e maintained in free time by volunteers. The development may continue\n\u003e for decades or may stop tomorrow. You can use\n\u003e [GitHub Sponsorship](https://github.com/sponsors/chshersh) to support\n\u003e the development of this project.\n\n## How to use?\n\n`ghc-plugin-non-empty` is compatible with the following GHC\nversions — [supported versions](https://matrix.hackage.haskell.org/#/package/ghc-plugin-non-empty)\n\nIn order to start using `ghc-plugin-non-empty` in your project, you'll\nneed to set it up with these steps:\n\n1. Add the dependency on `ghc-plugin-non-empty` in your project's\n   `.cabal` file. For this, you should modify the `build-depends`\n   section according to the below section:\n\n   ```haskell\n   build-depends:\n     , base                 ^\u003e= LATEST_SUPPORTED_BASE\n     , ghc-plugin-non-empty ^\u003e= LATEST_VERSION\n   ```\n\n2. To use this package, refer to the below example.\n\n   ```haskell\n   {-# OPTIONS_GHC -fplugin=GhcPluginNonEmpty #-}\n\n   module Main (main) where\n\n   import Data.List.NonEmpty (NonEmpty)\n\n   exampleList :: NonEmpty Int\n   exampleList = [100, 5, 74]\n\n   main :: IO ()\n   main = print exampleList\n   ```\n\n## For contributors\n\nCheck [CONTRIBUTING.md](https://github.com/chshersh/ghc-plugin-non-empty/blob/main/CONTRIBUTING.md)\nfor contributing guidelines.\n\nTo build the project and run the tests, use `cabal`:\n\n```shell\ncabal build all\ncabal test --enable-tests --test-show-details=direct\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchshersh%2Fghc-plugin-non-empty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchshersh%2Fghc-plugin-non-empty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchshersh%2Fghc-plugin-non-empty/lists"}