{"id":19502333,"url":"https://github.com/zio/interop-cats","last_synced_at":"2025-04-08T09:09:22.199Z","repository":{"id":39707047,"uuid":"191025592","full_name":"zio/interop-cats","owner":"zio","description":"ZIO instances for cats-effect type classes","archived":false,"fork":false,"pushed_at":"2025-03-25T20:21:52.000Z","size":857,"stargazers_count":158,"open_issues_count":17,"forks_count":68,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-04-01T08:38:33.936Z","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/zio.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-09T15:49:52.000Z","updated_at":"2025-03-25T20:25:44.000Z","dependencies_parsed_at":"2024-02-17T20:26:46.047Z","dependency_job_id":"290ec3bb-ed0c-410a-b228-efc47bb4a4f9","html_url":"https://github.com/zio/interop-cats","commit_stats":{"total_commits":323,"total_committers":43,"mean_commits":7.511627906976744,"dds":0.4860681114551083,"last_synced_commit":"bf24db580870f23ef1a8493335b340ac43ba0e71"},"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Finterop-cats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Finterop-cats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Finterop-cats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Finterop-cats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zio","download_url":"https://codeload.github.com/zio/interop-cats/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247809964,"owners_count":20999816,"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-11-10T22:16:06.211Z","updated_at":"2025-04-08T09:09:22.142Z","avatar_url":"https://github.com/zio.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"[//]: # (This file was autogenerated using `zio-sbt-website` plugin via `sbt generateReadme` command.)\n[//]: # (So please do not edit it manually. Instead, change \"docs/index.md\" file or sbt setting keys)\n[//]: # (e.g. \"readmeDocumentation\" and \"readmeSupport\".)\n\n# ZIO Interop Cats\n\n## Installation\n\n```sbt\nlibraryDependencies += \"dev.zio\" %% \"zio-interop-cats\" % \"\u003clatest-version\u003e\"\n```\n\n## `ZIO` Cats Effect 3 instances\n\n**ZIO** integrates with Typelevel libraries by providing an instance of `Concurrent`, `Temporal` and `Async` for `Task`\nas required, for instance, by `fs2`, `doobie` and `http4s`.\n\nFor convenience, the ZIO library defines an alias as follows:\n\n```scala\ntype Task[A] = ZIO[Any, Throwable, A]\n```\n\nTherefore, we provide Cats Effect instances based on this specific datatype.\n\n## `Concurrent`\n\nIn order to get a `Concurrent[Task]` or `Concurrent[RIO[R, *]]` (note `*` is kind-projector notation) we need to import `zio.interop.catz._`:\n\n```scala\nimport cats.effect._\nimport zio._\nimport zio.interop.catz._\n\ndef ceConcurrentForTaskExample = {\n  val F: cats.effect.Concurrent[Task] = implicitly\n  F.racePair(F.unit, F.unit)\n}\n```\n\n## `Temporal`\n\n```scala\nimport cats.effect._\nimport zio._\nimport zio.interop.catz._\n\ndef ceTemporal = {\n  val F: cats.effect.Temporal[Task] = implicitly\n  F.sleep(1.second) *\u003e F.unit\n}\n```\n\n## `Async`\n\n```scala\nimport cats.effect._\nimport zio._\nimport zio.interop.catz._\n\ndef ceAsync = {\n  val F: cats.effect.Async[Task] = implicitly\n  F.racePair(F.unit, F.sleep(1.second) *\u003e F.unit)\n}\n```\n\n## Other typeclasses\n\nThere are many other typeclasses and useful conversions that this library provides implementations for:\n* See `zio/interop/cats.scala` file to see all available typeclass implementations for the Cats Effect 3 typeclasses\n* See `zio/stream/interop/cats.scala` for ZStream typeclass implementations\n* See `zio/stream/interop/FS2StreamSyntax.scala` for FS2 \u003c-\u003e ZStream conversions\n\n\n### cats-core\n\nIf you only need instances for `cats-core` typeclasses, not `cats-effect` import `zio.interop.catz.core._`:\n\n```scala\nimport zio.interop.catz.core._\n```\n\nNote that this library only has an `Optional` dependency on cats-effect – if you or your libraries don't depend on it, this library will not add it to the classpath.\n\n### Example\n\nThe following example shows how to use ZIO with Doobie (a library for JDBC access) and FS2 (a streaming library), which both rely on Cats Effect instances (`cats.effect.Async` and `cats.effect.Temporal`):\n\n```scala\nimport zio.{durationInt as _, *}\nimport zio.interop.catz.*\nimport doobie.*\nimport doobie.implicits.*\nimport scala.concurrent.duration.*\n\nobject Example extends ZIOAppDefault:\n  val run = {\n    val xa: Transactor[Task] =\n      Transactor.fromDriverManager[Task](\"org.h2.Driver\", \"jdbc:h2:mem:test;DB_CLOSE_DELAY=-1\", \"user\", \"\", None)\n\n    sql\"SELECT 42\"\n      .query[Int]\n      .stream\n      .transact(xa)\n      .delayBy(1.second)\n      .evalTap(i =\u003e Console.printLine(i))\n      .compile\n      .drain\n      .exitCode\n  }\n```\n\n## Documentation\n\nLearn more on the [ZIO Interop Cats homepage](https://zio.dev)!\n\n## Contributing\n\nFor the general guidelines, see ZIO [contributor's guide](https://zio.dev/contributor-guidelines).\n\n## Code of Conduct\n\nSee the [Code of Conduct](https://zio.dev/code-of-conduct)\n\n## Support\n\nCome chat with us on [![Badge-Discord]][Link-Discord].\n\n[Badge-Discord]: https://img.shields.io/discord/629491597070827530?logo=discord \"chat on discord\"\n[Link-Discord]: https://discord.gg/2ccFBr4 \"Discord\"\n\n## License\n\n[License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzio%2Finterop-cats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzio%2Finterop-cats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzio%2Finterop-cats/lists"}