( self: DocStream.DocStream<A>, M: monoid.Monoid<M>, f: (a: A) => M )
| 379 | >(3, (self, M, f) => Effect.runSync(foldMapSafe(self, M, f))) |
| 380 | |
| 381 | const foldMapSafe = <A, M>( |
| 382 | self: DocStream.DocStream<A>, |
| 383 | M: monoid.Monoid<M>, |
| 384 | f: (a: A) => M |
| 385 | ): Effect.Effect<M> => { |
| 386 | switch (self._tag) { |
| 387 | case "CharStream": { |
| 388 | return Effect.suspend(() => foldMapSafe(self.stream, M, f)) |
| 389 | } |
| 390 | case "TextStream": { |
| 391 | return Effect.suspend(() => foldMapSafe(self.stream, M, f)) |
| 392 | } |
| 393 | case "LineStream": { |
| 394 | return Effect.suspend(() => foldMapSafe(self.stream, M, f)) |
| 395 | } |
| 396 | case "PushAnnotationStream": { |
| 397 | return Effect.map( |
| 398 | Effect.suspend(() => foldMapSafe(self.stream, M, f)), |
| 399 | (that) => M.combine(f(self.annotation), that) |
| 400 | ) |
| 401 | } |
| 402 | case "PopAnnotationStream": { |
| 403 | return Effect.suspend(() => foldMapSafe(self.stream, M, f)) |
| 404 | } |
| 405 | default: { |
| 406 | return Effect.succeed(M.empty) |
| 407 | } |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | /** @internal */ |
| 412 | export const match = dual< |
no test coverage detected
searching dependent graphs…