Skip to content

Commit

Permalink
Merge pull request #29 from VirtusLab/unify-cats-modules
Browse files Browse the repository at this point in the history
Unify cats modules
  • Loading branch information
KacperFKorban authored Sep 27, 2022
2 parents 552284e + 3bfeed5 commit 115acf6
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 480 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: AvocADO

on:
push:
Expand All @@ -11,7 +11,7 @@ env:
branch-name: ${GITHUB_REF#refs/heads/}

jobs:
buildSbt:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![avocado Scala version support](https://index.scala-lang.org/virtuslab/avocado/avocado/latest.svg)](https://index.scala-lang.org/virtuslab/avocado/avocado)
[![avocado Scala version support](https://index.scala-lang.org/virtuslab/avocado/avocado/latest-by-scala-version.svg?platform=jvm)](https://index.scala-lang.org/virtuslab/avocado/avocado)

# avocADO - Safe compile-time parallelization of `for` comprehensions

Expand All @@ -8,7 +8,7 @@
import cats.effect.IO

import avocado.*
import avocado.instances.catseffect3.given
import avocado.instances.cats.given

val run: IO[Int] =
ado {
Expand Down Expand Up @@ -42,17 +42,19 @@ The name `avocADO` is a pun on the most important function exposed by the librar
```scala
libraryDependencies ++= Seq(
"org.virtuslab" %% "avocado" % "version from the badge",
"org.virtuslab" %% "avocado-cats-effect-3" % "version from the badge", // for Cats Effect 3.x
"org.virtuslab" %% "avocado-cats" % "version from the badge", // for Cats
"org.virtuslab" %% "avocado-zio-2" % "version from the badge", // for ZIO 2.x
"org.virtuslab" %% "avocado-zio-1" % "version from the badge", // for ZIO 1.x
)
```

### scala-cli

```scala
//> using lib "org.virtuslab::avocado:version from the badge"
//> using lib "org.virtuslab::avocado-cats-effect-3:version from the badge" // for Cats Effect 3.x
//> using lib "org.virtuslab::avocado-cats:version from the badge" // for Cats
//> using lib "org.virtuslab::avocado-zio-2:version from the badge" // for ZIO 2.x
//> using lib "org.virtuslab::avocado-zio-1:version from the badge" // for ZIO 1.x
```

## Usage (in code)
Expand All @@ -61,8 +63,9 @@ All you need to do in order to use `avocADO` is to import the `ado` function and
```scala
import avocado.* // This line exposes the `ado` function - entrypoint of the library
// You should choose one of the following imports depending on your effect system of choice
import avocado.instances.catseffect3.given
import avocado.instances.cats.given
import avocado.instances.zio2.given
import avocado.instances.zio1.given
```

And that's it! All that's left is to wrap the `for`-comprehensions that you want to parallelize with a call to `ado` an watch your program run in parallel! Like so:
Expand Down
24 changes: 6 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ lazy val root = project
)
.aggregate((
avocado.projectRefs
++ catsEffect3.projectRefs
++ cats.projectRefs
++ zio2.projectRefs
++ zio1.projectRefs
++ catsEffect2.projectRefs
)*)

lazy val avocado = projectMatrix
Expand All @@ -49,25 +48,14 @@ lazy val avocado = projectMatrix
)
.jvmPlatform(scalaVersions = List(scala3))

lazy val catsEffect3 = projectMatrix
.in(file("cats-effect-3"))
lazy val cats = projectMatrix
.in(file("cats"))
.settings(commonSettings)
.settings(
name := "avocADO-cats-effect-3",
name := "avocADO-cats",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-effect" % "3.3.14"
)
)
.dependsOn(avocado)
.jvmPlatform(scalaVersions = List(scala3))

lazy val catsEffect2 = projectMatrix
.in(file("cats-effect-2"))
.settings(commonSettings)
.settings(
name := "avocADO-cats-effect-2",
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-effect" % "2.5.5"
"org.typelevel" %% "cats-core" % "2.8.0",
"org.typelevel" %%% "cats-effect" % "3.3.14" % Test
)
)
.dependsOn(avocado)
Expand Down
23 changes: 0 additions & 23 deletions cats-effect-2/src/test/scala/BaseCatsEffect2Test.scala

This file was deleted.

201 changes: 0 additions & 201 deletions cats-effect-2/src/test/scala/CatsEffect2TCTests.scala

This file was deleted.

Loading

0 comments on commit 115acf6

Please sign in to comment.