{"id":29097393,"url":"https://github.com/lambdaisland/uniontypes","last_synced_at":"2025-09-19T12:11:17.141Z","repository":{"id":62433268,"uuid":"69083949","full_name":"lambdaisland/uniontypes","owner":"lambdaisland","description":"Union Types (ADTs, sum types) built on clojure.spec","archived":false,"fork":false,"pushed_at":"2023-07-24T22:08:07.000Z","size":955,"stargazers_count":115,"open_issues_count":1,"forks_count":5,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-08-23T21:45:23.235Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lambdaisland.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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}},"created_at":"2016-09-24T06:08:41.000Z","updated_at":"2025-04-30T04:12:07.000Z","dependencies_parsed_at":"2024-04-17T14:25:24.576Z","dependency_job_id":"94208f7a-9108-4c03-9061-3782b0f361ad","html_url":"https://github.com/lambdaisland/uniontypes","commit_stats":{"total_commits":20,"total_committers":6,"mean_commits":"3.3333333333333335","dds":"0.44999999999999996","last_synced_commit":"d1b847098284130fb0ff3ed786ade8cf83dfa399"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/lambdaisland/uniontypes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaisland%2Funiontypes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaisland%2Funiontypes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaisland%2Funiontypes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaisland%2Funiontypes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lambdaisland","download_url":"https://codeload.github.com/lambdaisland/uniontypes/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdaisland%2Funiontypes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275934864,"owners_count":25555523,"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","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-06-28T13:42:07.176Z","updated_at":"2025-09-19T12:11:17.107Z","avatar_url":"https://github.com/lambdaisland.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/lambdaisland/uniontypes.svg?branch=master)](https://travis-ci.org/lambdaisland/uniontypes)\n[![Clojars Project](https://img.shields.io/clojars/v/lambdaisland/uniontypes.svg)](https://clojars.org/lambdaisland/uniontypes)\n\n# lambdaisland/uniontypes\n\nUnion Types (Algebraic Data Types) for Clojure and ClojureScript, based on clojure.spec.\n\nProvides a `case-of` macro, which does case matching based on which branch in an\n`or` spec a value conforms to.\n\n`case-of` checks at compile time that all cases are handled, and if not throws an exception.\n\n## Installation\n\nTo install, add the following dependency to your project or build file:\n\n``` clojure\n[lambdaisland/uniontypes \"0.3.0\"]\n```\n\n## Usage\n\n``` clojure\n(require '[lambdaisland.uniontypes :refer [case-of]])\n\n(s/def ::availability (s/or :sold-out  #{:sold-out}\n                            :in-stock  pos-int?\n                            :reordered (s/tuple pos-int? pos-int?)\n                            :announced string?))\n\n(defn display-status [availability]\n  (case-of ::availability availability\n    :sold-out _\n    \"Sold out.\"\n\n    :in-stock amount\n    (str \"In stock: \" amount \" items left.\")\n\n    :reordered [min max]\n    (str \"Available again in \" min \" to \" max \"days\" )\n\n    :announced date\n    (str \"Available on \" date \".\")\n\n    :spec/invalid msg\n    (str \"Not a valid availability: \" msg)))\n```\n\n## License\n\nCopyright © 2016-2017 Arne Brasseur\n\nDistributed under the Mozille Public License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdaisland%2Funiontypes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdaisland%2Funiontypes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdaisland%2Funiontypes/lists"}