{"id":42493340,"url":"https://github.com/reactivecore/quest","last_synced_at":"2026-01-28T12:32:18.541Z","repository":{"id":222731768,"uuid":"758208530","full_name":"reactivecore/quest","owner":"reactivecore","description":"Rust-like question operator for Scala","archived":false,"fork":false,"pushed_at":"2024-02-25T19:42:09.000Z","size":32,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-02-25T20:46:19.037Z","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/reactivecore.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}},"created_at":"2024-02-15T20:48:42.000Z","updated_at":"2024-02-25T20:10:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8aa33ef-3363-46ec-93e3-5767d62b8e1f","html_url":"https://github.com/reactivecore/quest","commit_stats":null,"previous_names":["reactivecore/quest"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/reactivecore/quest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactivecore%2Fquest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactivecore%2Fquest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactivecore%2Fquest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactivecore%2Fquest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reactivecore","download_url":"https://codeload.github.com/reactivecore/quest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reactivecore%2Fquest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28845278,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-28T12:32:17.775Z","updated_at":"2026-01-28T12:32:18.535Z","avatar_url":"https://github.com/reactivecore.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust-like Question Operator for Scala 3\n\nThis small library introduces a Rust-like `?`-Operator for Scala 3.\n\n## Example\n\n\n```scala\n// Add to build.sbt\nlibraryDependencies += \"net.reactivecore\" %% \"quest\" % \u003cVersion\u003e\n```\n\n```scala\nimport quest.*\n\ndef getUser(id: Int): Option[String] = { ... }\n\ndef getPermissions(id: Int): Option[List[String]] = { ... }\n\ndef getUserAndPermissions(id: Int): Option[(String, List[String])] = quest {\n  val user = getUser(id).?\n  val permissions = getPermissions(id).?\n  Some((user, permissions))\n}\n```\n\n## Operations\n\n- `quest(f: =\u003e T): T` initiates a block within which the question operator can be utilized.\n- `?` extracts the value from some type (e.g. `Either[L,R]`) if it represents a success, or exits the quest block if it represents a failure.\n- `bail(value: T)`  immediately exits the quest block with the specified value. It's an alias for `scala.util.boundary.break`.\n\n## Supported Types\n\n- `Option[T]`\n- `Either[L,R]`\n- `Try[T]`\n\nTo use other types with the question operator, implement the `QuestionOperatorSupport` type class.\n\n## How it works\n\nThe quest block leverages `scala.util.boundary` which uses exceptions for early exit. In cases of failure, an `scala.util.boundary.Break` exception is thrown and caught by the `scala.boundary.apply` function. (Note that this is optimised to a labelled jump, instead of exception, when no intermediate closures are in between `?` and `quest`)\n\n\nTwo helper classes simplify its use:\n\n- `scala.boundary.Label[T]` captures the return type of the `quest`/`break` method, enabling the question operator and leveraging Scala's type system to determine the correct return type\n- `QuestionOperatorSupport[T]` decodes each supported type into it's Failure and Success type. Failure and Success type\n  can be gathered using the Aux-Pattern: `QuestionOperatorSupport.Aux[T,F,S]`\n\n## Features\n\n- Short notation\n- Minimal codebase (50 LOC)\n- Compatible with IntelliJ IDEA (unlike some macros)\n- Supports Loom-based virtual threads\n\n## Caveats\n\n- `scala.util.boundary` uses exceptions for control flow, deviating from purely functional Scala practices. This approach may cause issues in certain contexts:\n  - It is incompatible with delayed execution contexts (e.g., `Future`, Effect Systems or collection views), potentially throwing `Break` exceptions unexpectedly.\n  \n## Performance\n\n- A small performance test measured an overhead of ~5ns per Failure return per Call in comparison to flatMap and return.\n\n## Prior Art\n\n- Martin Ordersky: [Direct Style Scala (Scalar 2023)](https://www.youtube.com/watch?v=0Fm0y4K4YO8)\n- Built upon `scala.util.boundary` after Hint on Reddit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactivecore%2Fquest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freactivecore%2Fquest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freactivecore%2Fquest/lists"}