{"id":13484844,"url":"https://github.com/Iltotore/iron","last_synced_at":"2025-03-27T16:31:23.629Z","repository":{"id":45111382,"uuid":"329291386","full_name":"Iltotore/iron","owner":"Iltotore","description":"Strong type constraints for Scala","archived":false,"fork":false,"pushed_at":"2025-03-22T17:50:09.000Z","size":1514,"stargazers_count":483,"open_issues_count":5,"forks_count":47,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-03-22T18:35:53.065Z","etag":null,"topics":["assert","functional-programming","refinement-types","scala","types"],"latest_commit_sha":null,"homepage":"https://iltotore.github.io/iron/docs/","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Iltotore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2021-01-13T11:48:58.000Z","updated_at":"2025-03-22T17:49:50.000Z","dependencies_parsed_at":"2023-12-19T05:57:09.893Z","dependency_job_id":"999e999c-9bdf-4092-9ad3-dd95f549453d","html_url":"https://github.com/Iltotore/iron","commit_stats":{"total_commits":205,"total_committers":19,"mean_commits":"10.789473684210526","dds":0.3902439024390244,"last_synced_commit":"a10396cb2521526ca0f363170c461cc3cda6be71"},"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iltotore%2Firon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iltotore%2Firon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iltotore%2Firon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iltotore%2Firon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Iltotore","download_url":"https://codeload.github.com/Iltotore/iron/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245882392,"owners_count":20687878,"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":["assert","functional-programming","refinement-types","scala","types"],"created_at":"2024-07-31T17:01:36.043Z","updated_at":"2025-03-27T16:31:23.034Z","avatar_url":"https://github.com/Iltotore.png","language":"Scala","funding_links":[],"categories":["Scala"],"sub_categories":[],"readme":"![logo](https://github.com/Iltotore/iron/blob/main/logo.png?raw=true)\n\n[![Scala version support](https://index.scala-lang.org/iltotore/iron/iron/latest-by-scala-version.svg)](https://index.scala-lang.org/iltotore/iron/iron)\n[![CI](https://github.com/Iltotore/iron/actions/workflows/ci.yml/badge.svg)](https://github.com/Iltotore/iron/actions/workflows/ci.yml)\n___\n\nIron is a lightweight library for refined types in Scala 3.\n\nIt enables attaching constraints/assertions to types, to enforce properties and forbid invalid values.\n\n- **Catch bugs.** In the spirit of static typing, use more specific types to avoid invalid values.\n- **Compile-time and runtime.** Evaluate constraints at compile time, or explicitly check them at runtime (e.g. for a\n  form).\n- **Seamless.** Iron types are subtypes of their unrefined versions, meaning you can easily add or remove them.\n- **No black magic.** Use Scala 3's powerful inline, types and restricted macros for consistent behaviour and rules. No\n  unexpected behaviour.\n- **Extendable.** Easily create your own constraints or integrations using classic typeclasses.\n\nTo learn more about Iron, see the [microsite](https://iltotore.github.io/iron/docs/index.html).\n\n## Example\n\n```scala\nimport io.github.iltotore.iron.*\nimport io.github.iltotore.iron.constraint.numeric.*\n\ndef log(x: Double :| Positive): Double =\n  Math.log(x) //Used like a normal `Double`\n\nlog(1.0) //Automatically verified at compile time.\nlog(-1.0) //Compile-time error: Should be strictly positive\n\nval runtimeValue: Double = ???\nlog(runtimeValue.refineUnsafe) //Explicitly refine your external values at runtime.\n\nruntimeValue.refineEither.map(log) //Use monadic style for functional validation\nruntimeValue.refineEither[Positive].map(log) //More explicitly\n```\n\n## Helpful error messages\n\nIron provides useful errors when a constraint does not pass:\n\n```scala\nlog(-1.0)\n```\n\n```scala\n-- Constraint Error --------------------------------------------------------\nCould not satisfy a constraint for type scala.Double.\n\nValue: -1.0\nMessage: Should be strictly positive\n----------------------------------------------------------------------------\n```\n\nOr when it cannot be verified:\n\n```scala\nval runtimeValue: Double = ???\nlog(runtimeValue)\n```\n\n```scala\n-- Constraint Error --------------------------------------------------------\nCannot refine non full inlined input at compile-time.\nTo test a constraint at runtime, use the `refine` extension method.\n\nNote: Due to a Scala limitation, already-refined types cannot be tested at compile-time (unless proven by an `Implication`).\n\nInlined input: runtimeValue\n----------------------------------------------------------------------------\n```\n\n## Import in your project\n\nSBT:\n\n```scala\nlibraryDependencies += \"io.github.iltotore\" %% \"iron\" % \"version\"\n```\n\nMill:\n\n```scala\nivy\"io.github.iltotore::iron:version\"\n```\n\n**Note: replace `version` with the version of Iron.**\n\n### Platform support\n\n| Module          | JVM | JS | Native |\n|-----------------|-----|----|--------|\n| iron            | ✔️  | ✔️ | ✔️     |\n| iron-borer      | ✔️  | ✔️ | ❌     |\n| iron-cats       | ✔️  | ✔️ | ✔️     |\n| iron-circe      | ✔️  | ✔️ | ✔️     |\n| iron-ciris      | ✔️  | ✔️ | ✔️     |\n| iron-decline    | ✔️  | ✔️ | ✔️     |\n| iron-doobie     | ✔️  | ❌  | ❌    |\n| iron-jsoniter   | ✔️  | ✔️ | ✔️     |\n| iron-pureconfig | ✔️  | ❌️ | ❌️     |\n| iron-scalacheck | ✔️  | ✔️ | ❌     |\n| iron-skunk      | ✔️  | ✔️ | ✔️     |\n| iron-upickle    | ✔️  | ✔️ | ✔️     |\n| iron-zio        | ✔️  | ✔️ | ❌     |\n| iron-zio-json   | ✔️  | ✔️ | ❌     |\n\n## Adopters\n\nHere is a non-exhaustive list of projects using Iron.\n\n[Submit a PR](https://github.com/Iltotore/iron/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc) to add your project or\ncompany to the list.\n\n### Companies\n\n- [Clever Cloud](https://www.clever-cloud.com)\n- [Ledger](https://github.com/LedgerHQ)\n- [Marss](https://github.com/marss)\n- [Association familiale Mulliez](https://fr.wikipedia.org/wiki/Association_familiale_Mulliez)\n\n### Other projects\n\n- [gvolpe/trading](https://github.com/gvolpe/trading) ([book](https://leanpub.com/feda))\n- [cheleb/laminar-form-derivation](https://github.com/cheleb/laminar-form-derivation)\n- [Lichess](https://lichess.org)\n- [Tessella](https://github.com/scala-tessella/tessella)\n\n## Useful links\n\n- [Website](https://iltotore.github.io/iron/docs/index.html)\n- [Scaladoc](https://iltotore.github.io/iron/index.html)\n- [Code of Conduct](https://iltotore.github.io/iron/docs/code-of-conduct.html)\n- [Contributing to Iron](https://iltotore.github.io/iron/docs/contributing.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIltotore%2Firon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIltotore%2Firon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIltotore%2Firon/lists"}