Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 05 2019 14:43
    @typelevel-bot banned @jdegoes
  • Jan 31 2019 21:17
    codecov-io commented #484
  • Jan 31 2019 21:08
    scala-steward opened #484
  • Jan 31 2019 18:19
    andywhite37 commented #189
  • Jan 31 2019 02:41
    kamilongus starred typelevel/cats-effect
  • Jan 30 2019 00:01
    codecov-io commented #483
  • Jan 29 2019 23:51
    deniszjukow opened #483
  • Jan 29 2019 23:37
  • Jan 29 2019 23:22
  • Jan 29 2019 20:26
    Rui-L starred typelevel/cats-effect
  • Jan 29 2019 18:01
    jdegoes commented #480
  • Jan 29 2019 17:04
    thomaav starred typelevel/cats-effect
  • Jan 28 2019 17:43
    asachdeva starred typelevel/cats-effect
  • Jan 28 2019 07:12
    alexandru commented #480
  • Jan 28 2019 05:45
    codecov-io commented #482
  • Jan 28 2019 05:35
    daron666 opened #482
  • Jan 27 2019 13:56
    codecov-io commented #481
  • Jan 27 2019 13:46
    lrodero opened #481
  • Jan 27 2019 05:47
    codecov-io commented #460
  • Jan 27 2019 05:37
    codecov-io commented #460
Jakub Kozłowski
@kubukoz
e.g. F[_] : Async, G[_] : Effect + G ~> F
Miles Sabin
@milessabin
This is a fantastic contribution ... hopefully a maintainer or two will find some time to take a look at it (nudge, nudge ...) typelevel/cats-effect#362
Fabio Labella
@SystemFw
will do
Fabio Labella
@SystemFw
I sure wish Github had a way to mark which comments are actually problems that need addressing to get an approval, and which are just comments (you may want to do this)
pacman899
@pacman899
Hi, I have an IO[A] and I want to convert it to F[A] (with Effect[F] in scope). is that possible?
Christopher Davenport
@ChristopherDavenport
liftIO should do the trick
pacman899
@pacman899
thanks!
Bob Glamm
@glammr1
Is IO.shift(cs) equivalent to cs.shift, assuming cs: ContextShift[IO]?
Jakub Kozłowski
@kubukoz
io.to[F]
@pacman899
@glammr1 I think it is, but you can see for yourself in how IO.contextShift is implemented
Bob Glamm
@glammr1
@kubukoz turns out the answer is yes from the definition of IO.shift:
  def shift(implicit cs: ContextShift[IO]): IO[Unit] =
    cs.shift
and now I feel pretty stupid since I actually looked at that definition before I asked the question :/
Jakub Kozłowski
@kubukoz
happens to all of us :)
Michael Zuber
@mgzuber

Hi, I was hoping someone could help me out with some code generalization. I have the following code that uses Monix's Task and works:

def completeDeferred[A](deferred: Deferred[Task, A], a: A) = deferred.complete(a).runAsync

I've tried to generalized this on T[_] : Effect but things don't seem to work

def completeDeferredGen[T[_]: Effect, A](deferred: Deferred[T, A], a: A) = deferred.complete(a).runAsync {
  case Left(ex) => IO { println(ex.getMessage) }
  case Right(_) => IO { }
}.unsafeRunSync

The following code works:

val app = for {
  d <- Deferred.apply[Task, String]
  _ = completeDeferred(d, "Hello")
  str <- d.get
} yield println(str)
Await.result(app.runAsync, 1.second)

But replacing completeDeferred with completeDeferredGen does not work. If anyone has any pointers I'd really appreciate it!

Fabio Labella
@SystemFw
@mgzuber you need ConcurrentEffect on your function
actually wait
let me try cause I might be wrong
that code works as is
wdym by "things don't seem to work"?
do you mean that you want the for to compile with completeDeferredGen?
also, are you doing all those runAsync.unsafeRunSync on purpose? you shoudln't be doing that
the println should also be wrapped
but all the code you've posted compiles for me, so maybe you can clarify what you're looking for a bit?
Michael Zuber
@mgzuber
yeah things compile fine
Fabio Labella
@SystemFw
ah ok
Michael Zuber
@mgzuber
but when I run using completeDeferredGen I get java.lang.AbstractMethodError
Fabio Labella
@SystemFw
I think you just have the wrong versions lying around
Michael Zuber
@mgzuber
whereas when I run with completeDeferred I get the expected output on the console
Fabio Labella
@SystemFw
e.g. you have Monix 2 and cats-effect 1.0
Michael Zuber
@mgzuber
mmm, I'm using Monix 3-RC1
but that depends on cats-effect-0.10
that could be the problem...
Fabio Labella
@SystemFw
that's it then
Michael Zuber
@mgzuber
yeah okay, that's a pain
off to the monix chat!
thanks for your help @SystemFw
Loïc Girault
@lgirault
Is there a reason why there is no method such asdef updateF(f: A => F[A]): F[Unit] for a Ref[F[_], A] ?
or do I miss a way to achieve it using the other methods ?
Or maybe I'm using the wrong tool for my task
Gavin Bisesi
@Daenyth
that seems trivially definable in your own code
smaller surface area in foundational libraries is a good thing
oh wait but => F[A]
hmm
Loïc Girault
@lgirault
yeah there is def update(f: A => A): F[Unit]
Gavin Bisesi
@Daenyth
problem being that get+update is not atomic
Loïc Girault
@lgirault
and its a get an set atomic. my "trivial" definition would lose atomicity
Gavin Bisesi
@Daenyth
yeah
I realized that after I said it
Loïc Girault
@lgirault
^_^