Part of the Scala Cats ecosystem for an IO type and associated effects.
Questions tagged [cats-effect]
191 questions
0
votes
0 answers
Specify number of digits for IO[Float] scala
I want to read a float, check the type provided by the user, identify number of digits which is fixed at two digits. For this :
I ve implemented these three functions. The first that reads the input from the console:
def readFloat: IO[Float] = IO…

Her sincerly
- 373
- 1
- 13
0
votes
0 answers
Guava cache removal not being triggered
I have a situation where some events I need to keep track of become "stale" after a specific timeout (expiryTimeout). Upon expiration, I need to "remove" references of the expired event, as well as notifying an external service that the event was…

mdm
- 3,928
- 3
- 27
- 43
0
votes
1 answer
Convert a list of stream values to a stream of values with fs2
I would like to define a function with the following signature using fs2 Streams, cats EitherT and cats-effect IO.
def list2Stream[A,B,F[_],S](vs: List[A],
f: A => EitherT[IO,S,Stream[IO,B]]
…

Labra
- 1,412
- 1
- 13
- 33
0
votes
1 answer
Stop long running process on a Resource
I have a resource which runs a potentially long blocking operation. In the real code, it's a ZeroMQ routine that waits for the next message (not too dissimilar to the example code here), but in this example, I've created a dummy loop that only…

Cesar Pantoja
- 173
- 3
- 11
0
votes
1 answer
Collecting data from all tasks executed on monix Scheduler
I'm using Monix Scheduler to execute some tasks periodically. But I don't know how to not just execute them, but also to collect result from them to some collection...
Lets say I have a scheduled task that returns a random number every time:
val…

Lykov
- 5
- 1
0
votes
1 answer
Sequential execution of IO from Future
I have simple combinations of two IO with sending message to Telegram bot
def send:Future[Message] = request(SendMessage(chatID, msg))
How to combine IO in greeting to get output "second" after "first" every time.
I tried to use *>, flatMap,…

Vadim
- 753
- 8
- 22
0
votes
1 answer
How execute spring repository method in for comprehension with implicit
I want to save data from telegram api in for comprehension type with implicit, but have an error
Error:(61, 9) type mismatch;
found : cats.effect.IO[Unit]
required: scala.concurrent.Future[?]
_ <-…

Vadim
- 753
- 8
- 22
0
votes
1 answer
type mismatch; found : cats.Show[shapeless.CNil] required: cats.Show[A] after adding scalac option -Ypartial-unification in sbt
I have below code.
import enumeratum.{Enum, EnumEntry}
sealed abstract class AppEnvironment extends EnumEntry
object AppEnvironment extends Enum[AppEnvironment] {
case object Local extends AppEnvironment
case object Testing extends…

user51
- 8,843
- 21
- 79
- 158
0
votes
1 answer
Intellij: Expression of type IO[Long] doesn't conform to expected type FS2_[O2_]
I tried the code of this Blog: a-streaming-library-with-a-superpower-fs2-and-functional-programming
In Intellij this code:
Stream("bob", "alice", "joe")
.evalMap(name => IO.fromFuture(IO(loadUserIdByName(name)))) // <- here is the exception
…

pme
- 14,156
- 3
- 52
- 95
0
votes
1 answer
logback.xml appender not used with cats IOApp
I have a scala app which uses the AWS Kinesis Client Library.
I am using logback with the logstash encoder to format the logs from my app and the KCL as JSON.
My App is also written using cats.effects.IO.
import cats.effects._
object Main extends…

tmortiboy
- 485
- 3
- 10
-1
votes
1 answer
cats-effect: Unable to see decrease in execution time when using `parSequence`
I am new to the cats-effect library, and I am running into an issue with parallel execution. I have an application that I think would benefit, but when I test the idea on a toy construct, I can't seem to see a difference in execution time. I feel…

Marvin Ward Jr
- 1,019
- 1
- 11
- 30