Most discussion is on Typelevel Discord: https://discord.gg/bSQBZA3Ced
eval_
is implemented using eval
which uses internal private types FromC and Algebra. I thought the intent would be to implement them more from the library users point of view.
eval
as a primitive
Algebra
eval_
using eval
and the other things you have learned so far?
eval_
from scratch :)
Hi everyone, so I have a Stream[F, Byte]
and I'd like to create a stream that emits 128kbps
. I'd like to keep the type Stream[F, Byte]
. To do this I figured I could make each Chunk
128kb
and have each Chunk
process every second.
Something like this:
val perSecond = scheduler.awakeEvery(500 millis)
val stream: Stream[F, Byte] =
inputStream
.chunks
.zip(perSecond)
.map(_._1)
.flatMap(Stream.chunk(_).covary[F])
.repeat
This works nicely (if there is a better way than this please let me know, I am an fs2 noob). The issue I'm having right now is making each Chunk
the proper size. I want each chunk to contain 16000
Byte
s, however when I read in my InputStream
it comes in at ~8000 bytes per chunk. Is there a way I can condense these chunks so that they're all roughly 16k bytes? I've looked through the Stream code and I see a lot of things about limiting chunk size, but that's just not what I want. Is this a completely dumb way of getting the result I want? Any help is appreciated. Thanks
take
is in terms of uncons
Pipe[F,O,O]
as type seems incompatible
Pull.output1
might be what you want to use
>>
s.pull.uncons1.flatMap {
case Some((o, tl)) =>
if(o == thing) {
output1(o) >> go(tl, n - 1)
}
else {
output1(o) >> go(tl,n)
}
case None =>
Pull.done
eval
returns it in R
not O
Pull.output/output1
is the command that lets you do so