Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 04:19
    404- forked
    404-/fs2
  • Jan 31 03:01
    SethTisue commented #1232
  • Jan 30 17:22
  • Jan 30 13:45
  • Jan 30 10:48
    pchlupacek commented #1406
  • Jan 30 10:47
    pchlupacek commented #1406
  • Jan 30 10:39
    pchlupacek commented #1407
  • Jan 30 09:58
    lJoublanc commented #870
  • Jan 30 09:42
    vladimir-popov commented #1407
  • Jan 30 08:10
    vladimir-popov closed #1407
  • Jan 30 08:10
    vladimir-popov commented #1407
  • Jan 29 19:20
    SystemFw commented #1407
  • Jan 29 19:20
    SystemFw commented #1407
  • Jan 29 18:57
    SystemFw commented #1406
  • Jan 29 17:47
    pchlupacek commented #1406
  • Jan 29 17:42
    pchlupacek commented #1406
  • Jan 29 17:39
    pchlupacek commented #1407
  • Jan 29 17:39
    vladimir-popov edited #1407
  • Jan 29 17:38
    vladimir-popov commented #1406
  • Jan 29 17:37
    pchlupacek commented #1406
Fabio Labella
@SystemFw
you can simply unNone to only take the options that are defined
Drew Boardman
@drewboardman
yeah exactly that
Fabio Labella
@SystemFw
cool so just add unNone after evalMap
Drew Boardman
@drewboardman
thanks!
it seems like i'm losing the IO context somewhere in there
when I unNone
do i need to type parametrize the evalMap?
i can wrap it in an IO.delay
val streamOfFoo: fs2.Stream[IO, Foo] =
  consumer.readFromKinesisStream[IO]("APPNAME", "KINESIS_STREAM_A")flatMap { committableRecord =>
    fs2.Stream
      .chunk(Chunk.byteBuffer(committableRecord.record.data))
      .through(io.circe.fs2.byteStreamParser[IO])
      .through(io.circe.fs2.decoder[IO, Foo])
      .evalMap(evt ⇒ IO.delay(Transformers.transform(evt)))
      .unNone
the through(io.circe.fs2.decoder[IO, Foo]) returns an fs2.Stream[IO, Foo]
Fabio Labella
@SystemFw
ah wait
I though you had a typo
Drew Boardman
@drewboardman
no typo
Fabio Labella
@SystemFw
just map(..).unNone if you don't have an IO around
Drew Boardman
@drewboardman
how am i losing IO context in the evalmap?
isnt just flatMap(o => Stream.eval(f(o))
Fabio Labella
@SystemFw
yes
it takes an A => IO[B] in your case
Drew Boardman
@drewboardman
hmm
Fabio Labella
@SystemFw
but you are passing to it an A => Option[B]
Drew Boardman
@drewboardman
you think I should keep IO.delay or the map(..).unNone?
Fabio Labella
@SystemFw
the latter
Drew Boardman
@drewboardman
I'd need to map it into an IO thoug
Fabio Labella
@SystemFw
I don't understand
does your function return A => IO[Option[B]] or A => Option[B]?
Drew Boardman
@drewboardman
second
Fabio Labella
@SystemFw
so map(...).unNone
Drew Boardman
@drewboardman
what function am i passing into the map?
oh, instead of evalMap
i see
ah, so If i want to do some effectful operation
than evalMap would be great
but since I'm doing a pure transformation, map is fine
Fabio Labella
@SystemFw
yeah
Drew Boardman
@drewboardman
i should have finished your control flow talk lmao
thanks for the help
Fabio Labella
@SystemFw
nw
Nik Gushchin
@Dr-Nikson
@SystemFw Hello!) Thanks for the link to this channel 👍🏼
Drew Boardman
@drewboardman
is there any possibility of IO being ran by the scala runtime, like how haskell does it?
Ryan Peters
@sloshy
@drewboardman As in, it being part of the standard library? Every app being an IO? Scala is built as being an impure functional language so it would fundamentally change a lot of things and break basically everybody's code if they did that. I don't think it's ever likely.
It would have to be a new language at this point, so pure FP in scala will stay opt-in.
IMO it's also nice that we have multiple implementations of the same ideas in the ecosystem for a "runtime" for effects. Cats Effect v Monix is a good historical example where each lib has different tradeoffs and styles
bifunctor
@bifunctor
Hi folks
How to make interval streams?
Paolo Anastagi
@poliez
What do you mean with "interval" stream? You mean like "Range"?
Michael Pilquist
@mpilquist
2.0.1 released with an important memory leak fix: https://github.com/functional-streams-for-scala/fs2/releases/tag/v2.0.1
Viktor Lövgren
@vlovgr
Looks like mima isn't happy about 2.0.0 -> 2.0.1: https://travis-ci.org/ovotech/fs2-kafka/builds/587924731 (errors toward end). Can someone verify that these are safe to exclude?
Viktor Lövgren
@vlovgr
Perfect, thanks!
bifunctor
@bifunctor
Could someone please explain be, what is a pipe?
Diego E. Alonso Blas
@diesalbla

@bifunctor A function from one stream to another stream in the same effect F.

type Pipe[F, - In, + Out] = Stream[F, In] => Stream[F, Out]

Nothing in that type tells you what the correspondence is between elements and effects in the input and the output stream.