{"id":17801042,"url":"https://github.com/refi64/hyskell","last_synced_at":"2025-06-26T14:32:34.222Z","repository":{"id":27698850,"uuid":"31185596","full_name":"refi64/hyskell","owner":"refi64","description":"Union types and some other functional-y stuff for Hy","archived":false,"fork":false,"pushed_at":"2016-01-29T17:49:58.000Z","size":8,"stargazers_count":51,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-22T03:52:50.730Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Hy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/refi64.png","metadata":{"files":{"readme":"README.rst","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-02-22T23:15:54.000Z","updated_at":"2025-03-02T23:17:21.000Z","dependencies_parsed_at":"2022-08-01T10:47:24.347Z","dependency_job_id":null,"html_url":"https://github.com/refi64/hyskell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/refi64/hyskell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refi64%2Fhyskell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refi64%2Fhyskell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refi64%2Fhyskell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refi64%2Fhyskell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/refi64","download_url":"https://codeload.github.com/refi64/hyskell/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refi64%2Fhyskell/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262085045,"owners_count":23256347,"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-27T12:33:16.047Z","updated_at":"2025-06-26T14:32:34.190Z","avatar_url":"https://github.com/refi64.png","language":"Hy","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hyskell\n=======\n\nThis brings two functional-ish things to Hy: accumulating for loops and unions/pattern matching. Just prefix your files with this:\n\n.. code-block:: hy\n   \n   (require hyskell)\n\naccfor\n******\n\n`accfor` is a `for` loop that is actually an iterator. It's basically `genexpr` with a nicer syntax that can take anything; not just a single expression.\n\n.. code-block:: hy\n   \n   (print (list (accfor [x [1 2 3]] x))) ; prints [1 2 3]\n\ndefunion\n********\n\nDefines a union type:\n\n.. code-block:: hy\n   \n   (defunion Node\n     (Nint val)\n     (Nstr val))\n\nThis example defines three types: `Node` (a base class), `Nint` (a class with one attribute: val), and `Nstr` (same as `Nint`).\n\nYou can use the types like any other type:\n\n.. code-block:: hy\n   \n   (setv i (Nint 7))\n   (setv s (Nstr \"abc\"))\n\nmatch\n*****\n\nTrue ML-style pattern matching:\n\n.. code-block:: hy\n   \n   (match value\n     [[1 2 3] (print \"Got list [1 2 3]\")] ; against a list\n     [[:a 2 3] (print \"Got list with a =\" a)] ; grab values with :\n     [(, 1 2) (print \"Got tuple (1, 2)\")] ; against a tuple\n     [1 (print \"Got 1\")] ; against an int or string\n     [(Nint :v) (print \"Got Nint with v =\" v)] ; against a union branch\n     [(Nstr (:val \"abc\")) (print \"Got Nstr with val of abc\")] ; use : at the beginning of an expression to test attributes\n     [(Nstr _) (print \"Got Nstr\")] ; use _ to ignore values\n     [[1 2 ...] (print \"Got list that starts with 1 and 2\")] ; use ... to allow extra items at the end\n     [[_ _ ...] (print \"Got list with \u003e= 2 elements\")] ; use ... with _ to do cool stuff\n     [_ (print \"Got something weird!\")]) ; you can also use _ for a fallthrough statement\n\nIf none of the branches match, a `hyskell.MatchFailure` exception is thrown.\n\nExamples\n********\n\nSee `test_hyskell.hy` for the unit tests, written using `HyTest \u003chttps://github.com/kirbyfan64/hytest\u003e`_.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefi64%2Fhyskell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frefi64%2Fhyskell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefi64%2Fhyskell/lists"}