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
Brian P. Holt
@bpholt
Oh, ok. I guess I was thinking Sync was required for other reasons and would just still be required.
Brian P. Holt
@bpholt

So constraining Pull.raiseError with AE ends up propagating out to compress.inflate (because it can raise an error if insufficient data is available). That makes this test, which explicitly operates on a PureStream, not work

There there are a couple other places that explicitly deal in Pipe[Pure, I, O] that I’m not sure what to do with:
https://github.com/functional-streams-for-scala/fs2/blob/f43fd1ce2bd173c545b6cd4ce482db0eba63d830/core/jvm/src/test/scala/fs2/MemorySanityChecks.scala#L138

https://github.com/functional-streams-for-scala/fs2/blob/f43fd1ce2bd173c545b6cd4ce482db0eba63d830/core/jvm/src/test/scala/fs2/PipeSpec.scala#L645

Any suggestions for what to do with these tests?

Michael Pilquist
@mpilquist
argh
Brian P. Holt
@bpholt
Stepper might be a problem too, because it can fail
Michael Pilquist
@mpilquist
yeah
there's always the Pull.done.map(_ => throw t) trick
but it seems like maybe this is a clue we shouldn't add this AE constraint
Brian P. Holt
@bpholt
I’m not sure I can make any useful observations on that… definitely following your lead here. 🤷🏻‍♂️
Michael Pilquist
@mpilquist
let's see what @SystemFw thinks
Brian P. Holt
@bpholt
There was a spot in Stream where we went straight to the algebra instead of going through raiseError… would something like that help here?
Michael Pilquist
@mpilquist
yeah, though the fact that this issue is showing up in "user code" like compress is what bothers me
in Stream, it only showed up in an implementation of a pretty fundamental combinator
Brian P. Holt
@bpholt
that’s true
although… Idk, inflate isn’t really a total function, is it? Not every input is valid, so is it really ok to run it in a pure context?
Michael Pilquist
@mpilquist
yeah, that's fair
alright i'm convinced by that :)
Stepper implementation is internal so that can use the algebra trick again (Pull.fromFreeC(Algebra.raiseError(t)))
Brian P. Holt
@bpholt
Actually I don’t see anywhere in Stepper that calls raiseError, but if Stepper.step returns Stepper.Fail, some of the test code does
e.g. StepperSanityTest
basically the same thing in both of those last two links I shared above
Michael Pilquist
@mpilquist
yeah
only solutions i have for that are (1) delete stepper entirely (2) use the Pure.done.map(_ => throw t) trick
Brian P. Holt
@bpholt
I’ll go with (2) for now and see how it shakes out
Brian P. Holt
@bpholt
FYI @mpilquist I just pushed #1224
Martijn Hoekstra
@martijnhoekstra
I'm still trying to understand the take example of Pull the uncons method gives a Pull[F,Nothing,Option[(Segment[O,Unit],Stream[F,O])]]. From what I understand is that should be seen as something from which you can pull elements of type Nothing, and once you are done pulling all elements, it will return an Option[(Segment[O,Unit],Stream[F,O])]
is that right?
if so, how is that different from just a plain Option[(Segment[O,Unit],Stream[F,O])], since there can't be any output values at all
Martijn Hoekstra
@martijnhoekstra
or an F[Option[(Segment[O,Unit],Stream[F,O])]]
Christopher Davenport
@ChristopherDavenport
@mpilquist It sounds like in compression we are saying that something that is throwing is pure, which seems incorrect to me.
Fabio Labella
@SystemFw
@martijnhoekstra Pull is a kind of effect, just like Stream or F
it can't be just plain Option, because pulling causes evaluation of the Stream which may trigger effects
and F is a more powerful thing that Pull
imagine Pull like a Free monad, or any other DSL, over stepping over a stream

From what I understand is that should be seen as something from which you can pull elements of type Nothing, and once you are done pulling all elements, it will return an Option[(Segment[O,Unit],Stream[F,O])]

That's something that can emit no elements (it can emit elements of type Nothing, of which there can be none), and that will return the Option when done

Martijn Hoekstra
@martijnhoekstra
what does "returning" mean here
Fabio Labella
@SystemFw
gtg for lunch now, are you going to here in a bit?
Martijn Hoekstra
@martijnhoekstra
yeah
Fabio Labella
@SystemFw
yea I'll ping you once I'm back
Martijn Hoekstra
@martijnhoekstra
great, thanks
I'm not sure what you mean by a DSL in this context - I always thought it was just a word for an interface that reads a bit like English if you squint enough because scala allows you to leave out the . in method calls
and the Free monad I've been told to not get in to but to look at tagless final instead
Martijn Hoekstra
@martijnhoekstra
I've annotated for as far as I understand at https://scastie.scala-lang.org/6DxyblRrTjG6iXNIFQnC0Q
Fabio Labella
@SystemFw
@martijnhoekstra ok then scratch that
scratch the free monad analogy I mean, not your notes :joy:
how familiar would you say you are with the idea of encoding effects as values, e.g. IO?
(also as a tangential point, it might be a bit easier to look at 1.0 which uses just Chunk as opposed to Segment, cause Chunk is way easier to understand)
Martijn Hoekstra
@martijnhoekstra
I understand IO as a type that's able to encode a computation, compose with other such computations, and (at the end of the world) peform them
Fabio Labella
@SystemFw
so, technically speaking the "end of the world" thing is outside of IO
but basically the general concept is this
and this is a pretty important thing to understand, because applies all over FP