{"id":18088245,"url":"https://github.com/earldouglas/linear-scala","last_synced_at":"2025-07-01T10:33:12.040Z","repository":{"id":38022456,"uuid":"367918921","full_name":"earldouglas/linear-scala","owner":"earldouglas","description":"Linear types in Scala","archived":false,"fork":false,"pushed_at":"2025-06-15T17:42:54.000Z","size":132,"stargazers_count":43,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-15T18:55:50.108Z","etag":null,"topics":["linear-types","scala","scalafix"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/earldouglas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-05-16T15:29:13.000Z","updated_at":"2025-06-15T17:42:57.000Z","dependencies_parsed_at":"2023-02-15T17:01:08.998Z","dependency_job_id":"5ecd5a58-4f5c-4811-b35a-d46856fd795e","html_url":"https://github.com/earldouglas/linear-scala","commit_stats":{"total_commits":111,"total_committers":1,"mean_commits":111.0,"dds":0.0,"last_synced_commit":"b41f36cb7bc4906d9c196b009c4516a3b3737ed4"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/earldouglas/linear-scala","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earldouglas%2Flinear-scala","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earldouglas%2Flinear-scala/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earldouglas%2Flinear-scala/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earldouglas%2Flinear-scala/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/earldouglas","download_url":"https://codeload.github.com/earldouglas/linear-scala/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earldouglas%2Flinear-scala/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262944265,"owners_count":23388724,"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":["linear-types","scala","scalafix"],"created_at":"2024-10-31T17:12:25.476Z","updated_at":"2025-07-01T10:33:11.977Z","avatar_url":"https://github.com/earldouglas.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status][build-badge]][build-link]\n[![Release Artifacts][release-badge]][release-link]\n\n[build-badge]: https://github.com/earldouglas/linear-scala/workflows/build/badge.svg \"Build Status\"\n[build-link]: https://github.com/earldouglas/linear-scala/actions \"GitHub Actions\"\n[release-link]: https://oss.sonatype.org/content/repositories/releases/com/earldouglas/linear-scala/ \"Sonatype Releases\"\n[release-badge]: https://img.shields.io/nexus/r/https/oss.sonatype.org/com.earldouglas/linear-scala \"Sonatype Releases\"\n\n# linear-scala\n\nlinear-scala adds support for linear types in Scala via a custom\nScalafix linter.\n\n## Setup\n\n*project/plugins.sbt:*\n\n```scala\naddSbtPlugin(\"com.earldouglas\" % \"sbt-linear-scala\" % \"0.0.3\")\n```\n\n## Usage\n\nMix in the `Linear` interface to prevent values from being\nunder/over-used.\n \n```scala\nimport com.earldouglas.linearscala.Linear\n\ncase class Box(value: Int) extends Linear\n```\n\nScalafix finds values that are never used:\n\n```scala\ntrait UnusedField {\n  val box: Box = Box(42) // error: box is never used\n}\n\ntrait UnusedParameter {\n  def foo(x: Box, y: Box): Int = // error: y is never used\n    x.value\n}\n```\n\nScalafix also finds values that are used multiple times:\n\n```scala\ntrait FieldUsedTwice {\n  val box: Box = Box(42)\n  println(box) // error: box is used twice\n  println(box) // error: box is used twice\n}\n```\n\nSee the tests in [input/src/main/scala/fix/](input/src/main/scala/fix/)\nfor more examples.\n\n## References\n\n### Linear Types\n\n* \u003chttps://earldouglas.com/talks/linear-scala.html\u003e\n* \u003chttps://gitlab.haskell.org/ghc/ghc/-/wikis/linear-types\u003e\n* \u003chttps://en.wikipedia.org/wiki/Substructural_type_system#Linear_type_systems\u003e\n* \u003chttps://github.com/ryanorendorff/lc-2018-linear-types\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearldouglas%2Flinear-scala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fearldouglas%2Flinear-scala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearldouglas%2Flinear-scala/lists"}