Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cats Effect: STM & TRef #791

Closed
jdegoes opened this issue Apr 24, 2019 · 4 comments
Closed

Cats Effect: STM & TRef #791

jdegoes opened this issue Apr 24, 2019 · 4 comments
Labels
cats effect Related to integration with Cats Effect.
Milestone

Comments

@jdegoes
Copy link
Member

jdegoes commented Apr 24, 2019

Introduce an effect-polymorphic class atop STM and TRef, with a default implementation for any Cats Effect data type (Cats IO, Monix Task, etc.).

package scalaz.zio.interop

trait STM[F[_], +A] {
  ...
}
object STM {
  def succeed[F[_]: ConcurrentEffect, A]: STM[F, A] = ???
  ...
}

trait TRef[F[_], A} { ... }
object TRef { ... }

The methods will all delegate to ZIO STM, but they will take the ZIO effect returned by STM methods and lift it into any effect F[_] that is suitable equipped.

@jdegoes jdegoes added the cats effect Related to integration with Cats Effect. label Apr 24, 2019
@jdegoes jdegoes added this to the 1.0.0 milestone Apr 24, 2019
@VladKopanev
Copy link
Contributor

I would like to try this one.

@VladKopanev
Copy link
Contributor

VladKopanev commented Apr 25, 2019

I think for convenience we could add def mapK[G[_]](f: F ~> G): STM[G, A] function to all such classes, not only STM but also Queue, Schedule, Stream & Sink, etc. Because all concurrency primitives from cats-effect has that, I guess we don't wanna users lost such ability. I can do that in same PR (For STM and TRef).

@jdegoes
Copy link
Member Author

jdegoes commented Apr 25, 2019

@VladKopanev Yes, that would be fantastic!

jdegoes pushed a commit that referenced this issue Apr 30, 2019
* Implement effect-polymorphic class atop STM #791

* Implement effect-polymorphic TRef #791

* remove unnecessary type parameters #791

* Add 'FunctionK' instance for converting TaskR to cats.IO #791

* Link to original documentation #791

* More efficient `collectAll` #791

* Make every method final #791

* Revert: Add 'FunctionK' instance for converting TaskR to cats.IO #791 (37d17db)

* Push implicits down to atomically #791

* Reorder methods alphabetically #791

* Fix formatting #791
Dan-M added a commit to Dan-M/scalaz-zio that referenced this issue May 2, 2019
* upstream/master:
  Cats Effect: STM & TRef zio#791 (zio#796)
  increase RS TCK timeouts in interopRS tests (zio#806)
  zio#804 Move ArbitraryCause.scala and GenIO.scala to shared (zio#809)
  docfix: Minor scaladoc fix
jdegoes pushed a commit that referenced this issue May 3, 2019
* Implement effect polymorphic TPromise, TQueue, TSemaphore #791

* Make TSemaphore to be AnyVal #791

* Fixes and docs #791
Dan-M added a commit to Dan-M/scalaz-zio that referenced this issue May 4, 2019
* upstream/master:
  Duration and DurationSyntax specs moved to shared test sources. (zio#813)
  Move FunctionIOSpec.scala to 'shared' (zio#804)
  Move RefSpec.scala to 'shared' (zio#804)
  Cats Effect: TPromise, TQueue, TSemaphore zio#791 (zio#814)
ghostdogpr pushed a commit to ghostdogpr/scalaz-zio that referenced this issue May 5, 2019
* Implement effect-polymorphic class atop STM zio#791

* Implement effect-polymorphic TRef zio#791

* remove unnecessary type parameters zio#791

* Add 'FunctionK' instance for converting TaskR to cats.IO zio#791

* Link to original documentation zio#791

* More efficient `collectAll` zio#791

* Make every method final zio#791

* Revert: Add 'FunctionK' instance for converting TaskR to cats.IO zio#791 (37d17db)

* Push implicits down to atomically zio#791

* Reorder methods alphabetically zio#791

* Fix formatting zio#791
ghostdogpr pushed a commit to ghostdogpr/scalaz-zio that referenced this issue May 5, 2019
* Implement effect polymorphic TPromise, TQueue, TSemaphore zio#791

* Make TSemaphore to be AnyVal zio#791

* Fixes and docs zio#791
@ghostdogpr
Copy link
Member

Done in #796

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cats effect Related to integration with Cats Effect.
Projects
None yet
Development

No branches or pull requests

3 participants