import type * as Arr from "../Array.ts"
import type * as Channel from "../Channel.ts"
import { identity } from "../Function.ts"
import { pipeArguments } from "../Pipeable.ts"
import type { Stream } from "../Stream.ts"
const TypeId = "~effect/Stream"
const streamVariance = {
_R: identity,
_E: identity,
_A: identity
}
const Stream: {
new, E, R>(
channel: Channel.Channel
): Stream ? A : never, E, R>
} = function, E, R>(
this: any,
channel: Channel.Channel
) {
this.channel = channel
} as any
Stream.prototype = {
[TypeId]: streamVariance,
pipe() {
return pipeArguments(this, arguments)
}
}
/** @internal */
export const fromChannel = , E, R>(
channel: Channel.Channel
): Stream ? A : never, E, R> => new Stream(channel)