#catseffect — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #catseffect, aggregated by home.social.
-
Моки без боли
Моки — достаточно крутой инструмент, если использовать его правильно. И все-таки лично для меня писать и поддерживать тесты на моках всегда было отдельным видом боли. Думаю, все знакомы с ситуацией: добавил в метод новый аргумент — и пошёл в 30 тест-кейсов проставлять заглушки. И это только от одного нового аргумента. И я не буду здесь спорить о терминологии — в этой статье я буду называть все тестовые дублёры «моками». Примеры будут на Scala, но моки в других языках работают похожим образом, так что боль универсальная. Как и решение — об этом в статье.
https://habr.com/ru/articles/1030834/
#scala #scalamock #zio #catseffect #тестирование #моки #стабы #моктестирование #юниттестирование
-
Моки без боли
Моки — достаточно крутой инструмент, если использовать его правильно. И все-таки лично для меня писать и поддерживать тесты на моках всегда было отдельным видом боли. Думаю, все знакомы с ситуацией: добавил в метод новый аргумент — и пошёл в 30 тест-кейсов проставлять заглушки. И это только от одного нового аргумента. И я не буду здесь спорить о терминологии — в этой статье я буду называть все тестовые дублёры «моками». Примеры будут на Scala, но моки в других языках работают похожим образом, так что боль универсальная. Как и решение — об этом в статье.
https://habr.com/ru/articles/1030834/
#scala #scalamock #zio #catseffect #тестирование #моки #стабы #моктестирование #юниттестирование
-
Моки без боли
Моки — достаточно крутой инструмент, если использовать его правильно. И все-таки лично для меня писать и поддерживать тесты на моках всегда было отдельным видом боли. Думаю, все знакомы с ситуацией: добавил в метод новый аргумент — и пошёл в 30 тест-кейсов проставлять заглушки. И это только от одного нового аргумента. И я не буду здесь спорить о терминологии — в этой статье я буду называть все тестовые дублёры «моками». Примеры будут на Scala, но моки в других языках работают похожим образом, так что боль универсальная. Как и решение — об этом в статье.
https://habr.com/ru/articles/1030834/
#scala #scalamock #zio #catseffect #тестирование #моки #стабы #моктестирование #юниттестирование
-
Моки без боли
Моки — достаточно крутой инструмент, если использовать его правильно. И все-таки лично для меня писать и поддерживать тесты на моках всегда было отдельным видом боли. Думаю, все знакомы с ситуацией: добавил в метод новый аргумент — и пошёл в 30 тест-кейсов проставлять заглушки. И это только от одного нового аргумента. И я не буду здесь спорить о терминологии — в этой статье я буду называть все тестовые дублёры «моками». Примеры будут на Scala, но моки в других языках работают похожим образом, так что боль универсальная. Как и решение — об этом в статье.
https://habr.com/ru/articles/1030834/
#scala #scalamock #zio #catseffect #тестирование #моки #стабы #моктестирование #юниттестирование
-
Cats-Effect 3.6.0 is a very exciting release due to the work on its internal work scheduler, many congrats to its contributors! ❤️
https://github.com/typelevel/cats-effect/releases/tag/v3.6.0
-
#Scala #CatsEffect #FP yep! And thanks @djspiewak for the release notes, they are always very well written
-
Cats-Effect 3.6.0-RC1 comes with some very exciting changes ❤️ Congrats to the team, they keep delivering 😍
https://github.com/typelevel/cats-effect/releases/tag/v3.6.0-RC1
-
#Scala it's that (and there's a lot of them), and also more. I think scala pushed the state of art regarding effect system, and things like #catseffect (more "Haskell inspired") and #zio (more "a Scala own thing") are quite amazing.
And #scala3 has really impressive things regarding types (see for ex #iron https://social.treehouse.systems/@fanf42/111935214728958950) -
Monadic effect systems (IO) are great, but they'll never be the (de jure) standard, as #Scala has Java's evaluation model and calling conventions.
The current standard for APIs doing I/O is `Future`. I'd rather have blocking I/O; easier to integrate w/ #CatsEffect, too.
-
Let’s reveal another surprise talk… Here’s @alexelcu presenting concurrency concepts of the JVM, sprinkled with some Cats-Effect utilities.
-
On #Scala's #CatsEffect library — one common myth is that it's a library built for “tagless final” (TF).
While it's true that it gives you unparalleled ability to use TF and monad transformer stacks, it's perfectly usable without. Most libraries from #Typelevel are.
-
I created a #chatgpt #Scala Cats Effect Tutor for fun take a look all:
https://chat.openai.com/g/g-anUfWL8Ty-scala-cats-effect-tutor
Feedback to make it better appreciated. I will be iterating on it, this is just an initial attempt.
Have fun all!
cc @typelevel
-
#CatsEffect or #ZIO - is there a library that beats another in this duel? Learn the differences, similarities, philosophy behind them both, and core features of those #Scala libraries and choose your favourite tool: https://softwaremill.com/cats-effect-vs-zio/
-
Note these are just minor pet peeves, it's just that FP folks often get too hung up on correctness.
OTOH #Typelevel #CatsEffect is a wonderful project, being #Scala's secret weapon.
-
A couple more releases downstream of Cats Effect:
* fs2: https://github.com/typelevel/fs2/releases/tag/v3.7.0
* http4s: https://github.com/http4s/http4s/releases/tag/v0.23.19
-
Currently, I am using a Cofree like DirTree data structure in #Akka to keep track of the actors responsible for a given resource so that we can send HTTP messages directly to them.
```scala
case class DirTree[R](
ref: R,
kids: HashMap[String, DirTree[R, A]] = HashMap()
):
```
https://github.com/co-operating-systems/Reactive-SoLiD/blob/30d6fd46fe30bc8be350c4a09d8592b20b791aa7/src/main/scala/run/cosy/ldp/DirTree.scala#L135I am synchronizing that with a #Java AtomicReference currently. I wonder if @alexelcu setup would make it easier to use a #CatsEffect Ref. One thing I had been thinking of is of wrapping the children in a `Ref` so that one would need to update only parts of the subtree if needed.
```scala
case class DirTree[R](
data: R,
kids: Ref[HashMap[String, DirTree[R]]]
):
```
https://www.pluralsight.com/tech-blog/scala-cats-effect-ref/By the way it should be quite easy to see why DirTree is just the Cofree Commonad with
```scala
type DirTree[A] = Cofree[Map[String,?],A]
```
But I can't quite see the advantages of using the Cofree right now.
https://typelevel.org/cats/api/cats/free/Cofree.html -
"Integrating #akka with #catseffect 3" is a blog post by
@alexelcu
https://alexn.org/blog/2023/04/17/integrating-akka-with-cats-effect-3/
This is relevant to me as my Reactive-Solid Server uses both Akka and Cats effects. My integration with Akka is very basic, though, at present.
I was wondering where else IO might be more useful in Akka. Would it be better to read and write files, for example?https://github.com/co-operating-systems/Reactive-SoLiD
I use cats-effect because I developed an HTTP-sig library that I need for clients and servers. It uses IO for signatures and for fetching the public key that signs the HTTP headers. https://github.com/bblfish/httpSigAt some point, I would like to extract some core libraries from Reactive Solid that could be used more easily with other frameworks. But I only have so much time... #scala
-
Having a blast coding using #scala :scala: , #typelevel #catseffect and #decline on a side project on this fine hot Saturday in the #BayArea :scala:
-
“ Kotlin Coroutines to Cats-Effect”
Small executable #Snippet, #Scala, #Kotlin, #CatsEffect
https://alexn.org/blog/2023/04/24/kotlin-suspended-functions-to-cats-effect-io/
-
An interesting fact about #Kotlin's coroutines is that `Dispatcher.IO` is limited. This, compared to the general advice in #Scala land, to use an unlimited thread-pool for blocking I/O. E.g., #CatsEffect's thread-pool for blocking I/O is unlimited.
https://github.com/Kotlin/kotlinx.coroutines/issues/2943
The reasoning they give is that too many threads can make the app really slow. Which is true, but then again, having a limit can lead to thread starvation & deadlocks, e.g…
https://gist.github.com/alexandru/e8ea5e728d77afde4f662b1f7a15ae78
-
My deep dive into #Kotlin's coroutines continues 😊 Here I learned that we can have a function similar to `IO.uncancelable` from #CatsEffect:
https://gist.github.com/alexandru/7527f83da03a32dbb46c281e95429ed6
The implementation for it is surprisingly short because, as it turns out, Kotlin uses `CoroutineContext` like some sort of mask that's compatible with the design of `IO.cancelable`:
I'm unsure if there are any gotchas, apart from the one I learned about `withContext`.
-
#Kotlin's coroutines are cool, but when compared with #Scala's offering, an underappreciated feature of #CatsEffect 3 is the very thoughtful and consistent treatment of cancellation and resource handling.
Kotlin's coroutines are error-prone for the same reason they are great … you can't visually discern “suspended” function calls from blocking calls, the problem being that correctness relies on needing to make suspended calls non-cancellable for acquisition and release…
-
Concurrency is hard... Check an introductory level tutorial of concurrency features provided by Cats Effect
-
Integrating #Akka and #CatsEffect 3 isn't without challenges, but the awesomeness of managing resources via Cats-Effect makes it all worth it, being #Scala's secret weapon.
I wrote a blog post describing some integration solutions we use for building payment processors. #FP #programming to the max 💪
Please share 🙏🥺
https://alexn.org/blog/2023/04/17/integrating-akka-with-cats-effect-3/
-
Catapult is Typelevel's newest project. It provides a Cats-Effect wrapper around the LaunchDarkly SDK for feature flag management.
-
Welcome Kamil Kloch as the next #Scalarconf speaker! 🚀
Cats Effect - Dispatcher, Supervisor, IOLocal
Grab your ticket 👉https://sml.io/tickets
#scala #functionalprogramming #conference2023 #itconference #catseffect
-
First public release of otel4s, an OpenTelemetry implementation for Cats Effect. otel4s aims to be a full and faithful impemenation of the OpenTelemetry Specification, built for the idioms of the Typelevel ecosystem.
-
First public release of otel4s, an OpenTelemetry implementation for Cats Effect. otel4s aims to be a full and faithful impemenation of the OpenTelemetry Specification, built for the idioms of the Typelevel ecosystem.
-
First public release of otel4s, an OpenTelemetry implementation for Cats Effect. otel4s aims to be a full and faithful impemenation of the OpenTelemetry Specification, built for the idioms of the Typelevel ecosystem.
-
First public release of otel4s, an OpenTelemetry implementation for Cats Effect. otel4s aims to be a full and faithful impemenation of the OpenTelemetry Specification, built for the idioms of the Typelevel ecosystem.
-
First public release of otel4s, an OpenTelemetry implementation for Cats Effect. otel4s aims to be a full and faithful impemenation of the OpenTelemetry Specification, built for the idioms of the Typelevel ecosystem.
-
Hey folks, I'm writing an article on the topic related to best practices for using Scala functional libraries: cats, cats-effect. Does anyone want to team up? You folks are all experienced here, and we could write something beneficial for the community together that ChatGPT won't.
#scala #fp #cats #catseffect #functionalprogramming