{"id":19884228,"url":"https://github.com/yawaramin/newtype","last_synced_at":"2025-10-12T06:34:42.851Z","repository":{"id":147930599,"uuid":"160911913","full_name":"yawaramin/newtype","owner":"yawaramin","description":"A newtype (non-allocating) wrapper type","archived":false,"fork":false,"pushed_at":"2019-02-07T15:13:08.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-04T08:58:57.005Z","etag":null,"topics":["newtype","scala"],"latest_commit_sha":null,"homepage":null,"language":"Scala","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/yawaramin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-08T06:40:46.000Z","updated_at":"2018-12-10T03:57:34.000Z","dependencies_parsed_at":"2023-05-28T00:45:30.538Z","dependency_job_id":null,"html_url":"https://github.com/yawaramin/newtype","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yawaramin/newtype","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fnewtype","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fnewtype/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fnewtype/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fnewtype/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yawaramin","download_url":"https://codeload.github.com/yawaramin/newtype/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yawaramin%2Fnewtype/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010516,"owners_count":26084757,"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-10-12T02:00:06.719Z","response_time":53,"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":["newtype","scala"],"created_at":"2024-11-12T17:25:51.738Z","updated_at":"2025-10-12T06:34:42.816Z","avatar_url":"https://github.com/yawaramin.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Newtype\n\nNamed after the [Haskell Newtype](https://wiki.haskell.org/Newtype), a\nScala module to help creating non-allocating wrapper types for existing\ntypes, if you're looking for an alternative to `AnyVal` and the\n'tagging' technique introduced by Scalaz and others.\n\n## Use\n\nDefine a new wrapper:\n\n```scala\nimport newtype.Newtype\n\nobject Types {\n  val Id: Newtype[Long] = Newtype(0.\u003c)\n  type Id = Id.Type\n}\n```\n\nThe `Newtype.apply` smart constructor provides a module containing the\nnewly-minted type and a set of operations to create and extract values\nof the type:\n\n```scala\nobject TypesTest {\n  import Types._\n\n  /* The constraint will prevent creating invalid values by throwing a\n     runtime exception: */\n  //val invalidId = Id(0)\n\n  val bobId: Id = Id(1)\n  val 1L = Id.value(bobId)\n}\n```\n\n## Develop\n\n* Add `-t` to enable watch mode\n* Add `--build-cache` to reuse outputs from previous builds (recommended\n  with `-t`)\n\nCompile:\n\n    ./gradlew compileScala\n\nTest:\n\n    ./gradlew test\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyawaramin%2Fnewtype","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyawaramin%2Fnewtype","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyawaramin%2Fnewtype/lists"}