// ets_tracing: off
import * as CS from "../../../../Cause";
import * as T from "../../../../Effect";
import { pipe } from "../../../../Function";
import * as Q from "../../../../Queue";
import * as Pull from "../../Pull";
import * as RepeatEffectChunkOption from "./repeatEffectChunkOption";
/**
 * Creates a stream from a queue of values
 */

export function fromChunkQueue(queue) {
  return RepeatEffectChunkOption.repeatEffectChunkOption(T.catchAllCause_(Q.take(queue), c => T.chain_(Q.isShutdown(queue), down => {
    if (down && CS.interrupted(c)) {
      return Pull.end;
    } else {
      return Pull.failCause(c);
    }
  })));
}
//# sourceMappingURL=fromChunkQueue.js.map