{"id":23651560,"url":"https://github.com/athanclark/poly-arity","last_synced_at":"2025-11-16T02:30:16.216Z","repository":{"id":31020273,"uuid":"34578776","full_name":"athanclark/poly-arity","owner":"athanclark","description":"Tools for working with functions without regard to their arity","archived":false,"fork":false,"pushed_at":"2017-03-19T04:24:04.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-28T16:38:15.159Z","etag":null,"topics":["arity","haskell","poly-arity"],"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/athanclark.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}},"created_at":"2015-04-25T17:38:18.000Z","updated_at":"2021-05-19T15:23:18.000Z","dependencies_parsed_at":"2022-09-08T17:22:45.279Z","dependency_job_id":null,"html_url":"https://github.com/athanclark/poly-arity","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpoly-arity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpoly-arity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpoly-arity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/athanclark%2Fpoly-arity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/athanclark","download_url":"https://codeload.github.com/athanclark/poly-arity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239611990,"owners_count":19668272,"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":["arity","haskell","poly-arity"],"created_at":"2024-12-28T16:38:24.873Z","updated_at":"2025-11-16T02:30:16.141Z","avatar_url":"https://github.com/athanclark.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"poly-arity\n==========\n\n\u003e Tools for working with functions of undetermined arity.\n\nMost of these tools are type-level constructs to ensure that your function types\nwill have a certain initial shape, because the function arrow `-\u003e` itself makes\na type-level list, where each `(-\u003e)` would be like `(:)`.\n\n## Usage\n\nYour first try might look something like this:\n\n```haskell\n{-# LANGUAGE\n    TypeFamilies\n  , TypeOperators\n  , DataKinds\n  , PolyKinds\n  , ConstraintKinds\n  , KindSignatures\n  , AllowAmbiguousTypes\n  #-}\n\nmodule Example where\n\nimport Data.Function.Poly\nimport Data.HList\n\n\ntype family (xs :: [k]) :++ (ys :: [k]) :: [k] where\n  '[]       :++ ys = ys\n  (x ': xs) :++ ys = x ': xs :++ ys\n\nfoo :: ( TypeListToArity xs r ~ f -- Proves the arity - list isomorphism\n       , ArityToTypeList f ~ (:++) xs (r ': '[])\n       ) =\u003e f -\u003e f\nfoo = id\n\nbar :: ( ArityMinusTypeList f xs ~ r -- Proves replacement\n       , ExpectArity xs f\n       ) =\u003e f -\u003e f\nbar = id\n\n-- warning - the above don't actually work :\\\n\nxs :: HList (Integer ': Bool ': Maybe () ': '[])\nxs = HCons (5 :: Integer) $ HCons True $ HCons (Just ()) HNil\n\n\nbaz :: Integer -\u003e Bool -\u003e Maybe () -\u003e String -\u003e ()\nbaz _ _ _ _ = ()\n```\n\nthen, we can toy with `appN` in `ghci`:\n\n```haskell\nλ\u003e :t baz `appN` xs\nbaz `appN` xs :: String -\u003e ()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathanclark%2Fpoly-arity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fathanclark%2Fpoly-arity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fathanclark%2Fpoly-arity/lists"}