-
Notifications
You must be signed in to change notification settings - Fork 89
Open
Labels
Description
Problem Statement
There are some cases where you want to use Abort for short circuit but you don't really care about the failure.
An example that came up in #1378 (comment) is:
private def emitElementsFromChannel[V](channel: Channel[V])(using Tag[Emit[Chunk[V]]], Frame) =
val emit = Loop.forever:
channel.take.map: v =>
Abort.recover[Closed](_ => Chunk.empty)(channel.drain).map: chunk =>
val fullChunk = Chunk(v).concat(chunk)
Emit.value(fullChunk)
Abort.run[Closed](emit).unit
end emitElementsFromChannelIn that case we don't care about the failure or success.
Proposed Solution
Something like:
Abort.ignore[Closed]which returns Unit < (S & reduce.SReduced)
Alternative Solutions
No response
Current Workaround
The workaround is not very bad at all so this is only a very minor improvement:
Abort.run[Closed](emit).unitAdditional Context
No response
Reactions are currently unavailable