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
Aaron Delaplane
@AaronDelaplane
Yeah, I clean compiled, reloaded sbt. Deleted the .idea directory and ran through the same re-build commands in IntelliJ. I think I'm just going to move on at this point. Thank you for the help though.
Adam Rosien
@arosien

ugh, sorry to hear that. i still do

for {
  x <- fx
  (a, b) = x
  ...
} yield ...

all the time. it's not too bad.

Fabio Labella
@SystemFw
yeah it's ok once you know it. It's annoying that newcomers need to stumble on it though, these things add up
Gavin Bisesi
@Daenyth
We should put a faq entry in about withFilter
so it gets found easier by google. Explain what the error means, why it isn't there, and what to do about it
will ticket that
Adam Rosien
@arosien
:thumbsup:
Gavin Bisesi
@Daenyth
rnd4222
@rnd4222_gitlab
Or you can add withFilter which depends on non-existent implicit w/ @implicitNotFound("do not use pattern-matching here")
Gavin Bisesi
@Daenyth
/shrug
Adam Rosien
@arosien
FYI this is the #1 google result for "scala value withfilter is not a member of"
Ross A. Baker
@rossabaker
Ooh, that's a nice idea. Move the FAQ into the compiler.
Adam Rosien
@arosien
if you parMapN in scala js, what happens?
are they executed sequentially, or is there some fanciness that shifts the computations over the (single) thread?
Fabio Labella
@SystemFw
the latter
but note that there is a question of fairness, and you are more likely to see sequential behaviour
Adam Rosien
@arosien
would the fanciness == an asynchronous boundary?
Aaron Delaplane
@AaronDelaplane
Sorry for the large code snippet. But am confused as to why numbers 2, 3, and 4 fail to execute subsequent lines once IO.sleep is called. Am reviewing the Cat's Effect docs...
// 1: works as expected: logs "a", "b", and "c"
(
  for {
    _ <- IO(println("a"))
    _ <- IO(println("b"))
    _ <- IO(println("c"))
  } yield ()
).unsafeRunSync()

// 2: only logs "a"
(
  for {
    _ <- IO(println("a"))
    _ <- IO.sleep(2.seconds)
    _ <- IO(println("b"))
    _ <- IO.sleep(2.seconds)
    _ <- IO(println("c"))
  } yield ()
).unsafeRunSync()

// 3: only logs "a"
(
  IO(println("a")) *>
    IO.sleep(2.seconds) *>
    IO(println("b")) *>
    IO.sleep(2.seconds) *>
    IO(println("c"))
).unsafeRunSync

// 4: only logs "a"
IO(println("a"))
  .flatMap(_ => IO.sleep(2.seconds))
  .flatMap(_ => IO(println("b")))
  .flatMap(_ => IO.sleep(2.seconds))
  .flatMap(_ => IO(println("c")))
  .unsafeRunSync()
Adam Rosien
@arosien
how is the implicit Timer[IO] defined? are you running in an IOApp?
Aaron Delaplane
@AaronDelaplane
No, I am not running in IOApp. At the moment just in the Ammonite REPL.
implicit val timer = IO.timer(scala.concurrent.ExecutionContext.global)
Fabio Labella
@SystemFw

would the fanciness == an asynchronous boundary?

yes, the runloop itself is not really aware of js, it just sees an ec to submit to. The only JVM specific thing in there (in CE3) is selecting the work stealing pool

Adam Rosien
@arosien
:thumbsup:
@AaronDelaplane i recall something where ammonite doesn't give you the actual global EC, or using the global EC for a timer has issues... let me check
basically your program is getting deadlocked (nothing awakens the sleep)
Aaron Delaplane
@AaronDelaplane
Ok. Yeah something I didn't try was creating a simple IOApp that runs the above expressions. That would probably be a way of establishing a source of truth.
Fabio Labella
@SystemFw
your code is correct
also in CE3 we have improved the repl experience, you can just import cats.effect.unsafe.implicits.global and call unsafeRunSync() on any IO
Adam Rosien
@arosien
@SystemFw do you recall what issues there are in ammonite with CE2? there is something, i just don't remember
Fabio Labella
@SystemFw
I don't really use ammonite so no
I do recall an issue with repl and unsafeRunSync, but that's it
Adam Rosien
@arosien
IO.sleep definitely hangs with a timer created with global
:angry:
Fabio Labella
@SystemFw
in ammonite you mean?
Adam Rosien
@arosien
yes
Adam Rosien
@arosien
wow, that's really annoying.
Aaron Delaplane
@AaronDelaplane
Everything works in IOApp:)
Adam Rosien
@arosien
of course!
if you paste the IOApp into ammonite, and invoke main, does it work?
Aaron Delaplane
@AaronDelaplane
@arosien Yes, it does. That's great to hear @SystemFw. Thanks for the help guys.
Adam Rosien
@arosien
yeah, mine prints
@ Blerg.main(Array.empty) 
a
b
c
so, don't use global :shrug:
i love/hate ammonite. it's weird.
there's some warnings, somewhere in the docs or source, that says don't use a global for x or y. but i can't find it. grrr
Aaron Delaplane
@AaronDelaplane
Yeah. I will actually lean on IOApp as a playground env more moving forward when I need to determine things. Don't worry about it, but thanks though.
I would rather be slightly inconvenienced if that means I get consistency. Kind of in the same vein as not using IntelliJ for anything I can do in SBT given that is the source of truth
Adam Rosien
@arosien
i use bloop as my baseline: integrates with VS Code for editing/compiling, and i can bloop run in the terminal to run things
Adam Rosien
@arosien
same idea :)
Aaron Delaplane
@AaronDelaplane
I never heard of it but it looks interesting
Adam Rosien
@arosien
https://scalacenter.github.io/bloop/ is a good start if you are interested
Felix Bruckmeier
@felixbr

Hi, I'm trying to implement the new typeclasses of cats-effect 3.0 for an effect type and I noticed that the signatures of bracketCase in Bracket and MonadCancel are not compatible. One uses ExitCase and one uses Outcome.

Is this intentional and if yes, why? 🙂