Effect CommunityEC
Effect Communityโ€ข3y agoโ€ข
9 replies
fubhy

Issue with `Stream.retry` in `pipe` causing error type parameter to become `unknown`

When using Stream.retry in
pipe
it seems to swallow the error type parameter to
unknown
.

E.g this becomes Stream<R, unknown, A>:

const stream = Stream.acquireRelease(aquire, ({ abort }) => Effect.succeed(abort())).pipe(
  Stream.flatMap(({ stream }) => stream),
  Stream.tap((response) => {
    if (response.message.case === "blockScopedData") {
      return Cursor.set(response.message.value.cursor);
    }

    return Effect.unit;
  }),
  Stream.retry(defaultRetryPolicy),
);




But this works (becomes Stream<R, E, A>):

const stream = Stream.acquireRelease(aquire, ({ abort }) => Effect.succeed(abort())).pipe(
  Stream.flatMap(({ stream }) => stream),
  Stream.tap((response) => {
    if (response.message.case === "blockScopedData") {
      return Cursor.set(response.message.value.cursor);
    }

    return Effect.unit;
  }),
);

return Stream.retry(stream, defaultRetryPolicy);


Am I doing sth. wrong?
Was this page helpful?