{"id":13566497,"url":"https://github.com/cb372/scala-typed-holes","last_synced_at":"2025-04-04T20:15:00.679Z","repository":{"id":33671779,"uuid":"160419032","full_name":"cb372/scala-typed-holes","owner":"cb372","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-11T16:53:27.000Z","size":186,"stargazers_count":187,"open_issues_count":6,"forks_count":17,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T19:11:26.409Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/cb372.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-04T21:07:53.000Z","updated_at":"2024-12-11T16:53:30.000Z","dependencies_parsed_at":"2024-01-19T07:12:53.277Z","dependency_job_id":"b1c089f4-3d02-4a08-a307-7340946e21d4","html_url":"https://github.com/cb372/scala-typed-holes","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb372%2Fscala-typed-holes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb372%2Fscala-typed-holes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb372%2Fscala-typed-holes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cb372%2Fscala-typed-holes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cb372","download_url":"https://codeload.github.com/cb372/scala-typed-holes/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242681,"owners_count":20907134,"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-08-01T13:02:10.848Z","updated_at":"2025-04-04T20:15:00.651Z","avatar_url":"https://github.com/cb372.png","language":"Scala","funding_links":[],"categories":["Scala"],"sub_categories":[],"readme":"# scala-typed-holes\n\nThis is a Scala compiler plugin to emulate the \"typed holes\" feature of Haskell,\nIdris, Agda, etc.\n\nWhenever you use `???` in your code, the compiler plugin will generate a\ncompiler warning containing useful information about it.\n\nFor example, given the Scala code\n\n```scala\npackage example\n\nobject Example {\n\n  def foo(x: Int, y: String): Boolean = {\n    if (y.length == x) {\n      ??? // TODO implement!\n    } else {\n      true\n    }\n  }\n\n  def bar(x: Int): String = x match {\n    case 0 =\u003e \"zero\"\n    case 1 =\u003e \"one\"\n    case _ =\u003e ???\n  }\n\n}\n```\n\nyou'll get warnings that look something like this:\n\n```\n[warn] /Users/chris/code/scala-typed-holes/src/test/scala/example/Example.scala:7:7:\n[warn] Found hole with type: Boolean\n[warn] Relevant bindings include\n[warn]   x: Int (bound at Example.scala:5:11)\n[warn]   y: String (bound at Example.scala:5:19)\n[warn]\n[warn]       ??? // TODO implement!\n[warn]       ^\n[warn] /Users/chris/code/scala-typed-holes/src/test/scala/example/Example.scala:16:15:\n[warn] Found hole with type: String\n[warn] Relevant bindings include\n[warn]   x: Int (bound at Example.scala:13:11)\n[warn]\n[warn]     case _ =\u003e ???\n[warn]               ^\n```\n\n## Named holes\n\nThe plugin also supports named holes. Instead of using `???`, you can give\ncustom names to your holes.\n\nFor example, code like this\n\n```scala\ndef hello(args: Array[String]): Option[Result] = Foo.doStuff(args) match {\n  case Left(error)  =\u003e __left\n  case Right(x)     =\u003e __right\n}\n```\n\nwill result in warnings like this\n\n```\nFound hole 'left' with type: Option[Result]\nRelevant bindings include\n  args: Array[String] (bound at input.scala:11:13)\n  error: String (bound at input.scala:12:15)\n\n    case Left(error)  =\u003e __left\n                         ^\n```\n\nNamed holes must start with a double underscore.\n\nWarning: if you happen to use a naming convention that includes double\nunderscores (which is pretty rare in Scala), this plugin will probably trash\nyour code!\n\n## How to use\n\nIn sbt:\n\n```\naddCompilerPlugin(\"com.github.cb372\" % \"scala-typed-holes\" % \"0.2.0\" cross CrossVersion.full)\n```\n\nThe plugin is published for the following Scala versions:\n\n* 2.11.12\n* 2.12.15\n* 2.13.{13, 14, 15}\n* 3.3.4\n* 3.4.3\n* 3.5.2\n* 3.6.2\n\n## Changing the log level\n\nBy passing a compiler option `-P:typed-holes:log-level:\u003clevel\u003e`, you can control\nthe severity with which holes are logged.\n\n* `info` means holes will be logged as informational messages\n* `warn` means holes will be logged as compiler warnings\n* `error` means holes will be logged as compiler errors, so your program will\n  fail to compile if it contains any holes.\n\nThe default behaviour is to log holes as warnings.\n\nIf you are using sbt, you can pass the option like this:\n\n```\nscalacOptions += \"-P:typed-holes:log-level:info\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcb372%2Fscala-typed-holes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcb372%2Fscala-typed-holes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcb372%2Fscala-typed-holes/lists"}