Resourceand struggling to understand why it's there; it appears superfluous to
Resource.userequires an implicit
Bracket. Is this just so that if your clean-up code is unwieldy, you can avoid writing
F.bracket(<my huge initialization/finalization code>)?
Resource. I guess that' swhere this is going ... but go on.
bracketcloses a resource as soon as the F finishes emitting elements
pure, you emit, so you have finished emitting, so the resource gets closed
emiton Stream, the stream has not finished emitting, because a Stream, unlike IO, can emit multiple elements, and therefore the thing is still fine
stream1 ++ stream2
sleep(or delay or whatever) doesn't produce any values, it is only evaluated for effects.
Resourceis to allow you writing more composable code
Resourcemonad you can just emit
Streamit will just
Streamcan do that
F, it will build the right
usefor you, and put it in