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
me_irl
Fabio Labella
@SystemFw
@ylaurent Pure FP is a massive win in usage. Where you pay the cost is an increase in upfront learning. However, we are here to help :)
ylaurent
@ylaurent
yep but it can be a bit frustrating sometimes, spending that much time on "minor" problem :sweat_smile:
Peter Aaser
@PeterAaser
Yeah, I've been pretty lost many times with fs2, that's for sure
I'm still lost in the grand scheme of things, but at least stockholm syndrom is really setting in and it's quite comfy
Christopher Davenport
@ChristopherDavenport
Once you get used to it, it seems like home. Like hypothermia.
In all seriousness its hard to imagine life without it at this point.
Peter Aaser
@PeterAaser
I really believe stream programming is going to be huge
I recently read the beating the averages essay, and to me stream programming feels a little like lisp in that essay
And I think if a team with 4-5 stream programming adepts were to hire 3-4 java devs they would get up to speed so much quicker than it takes to learn it by yourself from scratch
it's just daunting when you're not surrounded by people in the know
Christopher Davenport
@ChristopherDavenport
I feel my team has been picking it up very quickly. Much faster than when I was learning it.
However I would have been lost if it hadn’t been for this channel.
Peter Aaser
@PeterAaser
It's almost frustrating to learn other people fp... I HAD TO TRAVEL THROUGH THE BLOOD JUNGLE OF KHAR-THUUM TO LEARN THE SECRETS OF THE FREE MONAD, AND YOU, YOU GET IT ALL FOR FREE!!!
Yeah, same
but for real, when I'm done with my PhD I wanna get together a crack team of stream programmers and earn a billion dollars
(in my dreams)
Although I'd also settle for working for one of the functional scala or haskell shops
like luke going back to dagobah to complete his training
ylaurent
@ylaurent
@PeterAaser so in the end, callback invoked multiple times was what i was looking for :) thanks for the pointer!
  val subject = ConcurrentSubject.publish[ServerData]

  // push some data
  Observable.interval(1.second).foreach { i => subject.onNext(Heartbit(i)) }

  def rows[F[_]](implicit F: Effect[F], ec: ExecutionContext): Stream[F, ServerData] =
    for {
      q <- Stream.eval(async.unboundedQueue[F,Either[Throwable,ServerData]])
      _ <- Stream.suspend { subject.foreach { e => async.unsafeRunAsync(q.enqueue1(Right(e)))(_ => IO.unit) }; Stream.emit(()) }
      row <- q.dequeue.rethrow
    } yield row

  println(rows[IO].take(2).runLog.unsafeRunSync())
its just adapted from the doc, and it looks like black magic to me but it seems to do what i was looking for :+1:
Peter Aaser
@PeterAaser
Glad to hear that :)
Felix Mulder
@felixmulder
what' the reason that Topic.apply returns F[Topic[F, A]] ?
Luciano
@lJoublanc
You mean rather than just a Topic[F,A]?
Fabio Labella
@SystemFw
@felixmulder Initialising a Ref is an effectful operation, which therefore needs to be wrapped in F
all concurrent data structures rely on Ref, so the F carries over
Felix Mulder
@felixmulder
I see, then I guess I need to push the initialization to the edge of my program
Fabio Labella
@SystemFw
you do
Felix Mulder
@felixmulder
alright ^^ fair enough
Fabio Labella
@SystemFw
either by passing arguments manually, or Reader/Kleisli, or an HasTopic final tagless-style typeclass
where the "edge" would be the highest point in the call chain below which stuff needs to share the same Topic
Felix Mulder
@felixmulder
That's a good suggestion, I think I'll do that :D
Fabio Labella
@SystemFw
:+1:
Christopher Davenport
@ChristopherDavenport
Initialising a Ref is an effectful operation - for me to convey to others, what is effectful about it.
Generally allocation isn’t seen as an effect , so is it the internal actor and state? Just making sure I understand
Peter Aaser
@PeterAaser
Has anyone here ever used Oz?
dataflow variables <3
Fabio Labella
@SystemFw
@ChristopherDavenport Allocation is not an effect 99% of the time (although funnily enough there is an exception to this in Ref, but unrelated to what I was talking about)
it's about mutation
imagine you want to create a mutable reference
for simplicity, ignore concurrency
you can do:
var mut = 0

def set(i: Int) = mut = i
def get = must
but that's obviously impure
Christopher Davenport
@ChristopherDavenport
Obviously
Fabio Labella
@SystemFw
so we can try wrapping things in F
class IORef[A] {
  var a: A = null //doesn't compile in this form but conveys the idea
  def set(newA: A) = F.delay(a = newA)
  def get: F[A] = F.delay(a)
}
This is almost pure
the impurity now only lies in inisialisation