/** * Maps the output of this channel using the specified function. * * @tsplus static effect/core/stream/Channel.Aspects mapOut * @tsplus pipeable effect/core/stream/Channel mapOut */ export function mapOut(f: (o: OutElem) => OutElem2) { return ( self: Channel ): Channel => { const reader: Channel = Channel .readWith( (outElem) => Channel.write(f(outElem)).flatMap(() => reader), (outErr) => Channel.fail(outErr), (outDone) => Channel.succeed(outDone) ) return self >> reader } }