{"id":19520477,"url":"https://github.com/chariotsolutions/scala-commons","last_synced_at":"2026-05-12T13:39:00.990Z","repository":{"id":89518756,"uuid":"64402334","full_name":"chariotsolutions/scala-commons","owner":"chariotsolutions","description":"Common utilities we use in our Scala projects","archived":false,"fork":false,"pushed_at":"2016-08-16T16:16:07.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-26T00:27:06.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chariotsolutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-07-28T14:29:08.000Z","updated_at":"2016-07-29T12:43:24.000Z","dependencies_parsed_at":"2024-06-12T04:21:09.638Z","dependency_job_id":null,"html_url":"https://github.com/chariotsolutions/scala-commons","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chariotsolutions/scala-commons","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chariotsolutions%2Fscala-commons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chariotsolutions%2Fscala-commons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chariotsolutions%2Fscala-commons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chariotsolutions%2Fscala-commons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chariotsolutions","download_url":"https://codeload.github.com/chariotsolutions/scala-commons/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chariotsolutions%2Fscala-commons/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32942139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T09:19:52.626Z","status":"ssl_error","status_checked_at":"2026-05-12T09:17:33.438Z","response_time":102,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2024-11-11T00:25:48.372Z","updated_at":"2026-05-12T13:39:00.971Z","avatar_url":"https://github.com/chariotsolutions.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scala-commons\nCommon utilities we use in our Scala projects\n\n# FutureOr\n## Motivation\nWe have a lot of experience building [Reactive](https://www.lightbend.com/community/core-projects/scala) applications in Scala, so we work with `Future`s a lot, specifically when interacting with third-party APIs and non-blocking web services.  We also try to gracefully handle success and failure, and we've found that [Scalactic's Or](http://www.scalactic.org/user_guide/OrAndEvery) does a great job in that regard.  Consequently, we often have to execute and compose several calls where the return type is `Future[Good Or Bad]`.  Out of the box, this doesn't compose very gracefully.  So we made a `FutureOr`.\n\n`FutureOr` is a simple wrapper over the type `Future[T Or One[E]]`.  It provides some basic monadic functions and helpers to make working with `Future[T Or One[E]]` much easier.  Scalactic provides a nice type alias `ErrorMessage` to use for `E` to indicate errors, but we usually end up constructing our own error objects to make it easier to manage internationalization and API error statuses. \n\n## Examples\n### Simple composition of services returning a `Future[T Or One[E]]`\n    for {\n      int1 \u003c- FutureOr(service1.call())\n      int2 \u003c- FutureOr(service2.call())\n    } yield {\n      int1 + int2\n    }\n\n### From a sequence of `Future[T Or One[E]]`, create a future sequence and accumulate all of the `Bad` paths\n    val a: Future[Int Or One[E]] = serviceA.call();\n    val b: Future[Int Or One[E]] = serviceB.call();\n    val c: Future[Int Or One[E]] = serviceC.call();\n\n    val ints: Seq[Future[Int Or Every[E]]] = FutureOr.sequence(Seq(a, b, c))\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchariotsolutions%2Fscala-commons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchariotsolutions%2Fscala-commons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchariotsolutions%2Fscala-commons/lists"}