@effect/stream
Advanced tools
Comparing version 0.30.1 to 0.31.0
@@ -490,3 +490,3 @@ "use strict"; | ||
exports.mergeWith = mergeWith; | ||
const never = () => core.fromEffect(Effect.never); | ||
const never = /*#__PURE__*/core.fromEffect(Effect.never); | ||
/** @internal */ | ||
@@ -634,3 +634,3 @@ exports.never = never; | ||
const writeChunkWriter = (idx, len, chunk) => { | ||
return idx === len ? core.unit() : core.flatMap(() => writeChunkWriter(idx + 1, len, chunk))(core.write(Chunk.unsafeGet(idx)(chunk))); | ||
return idx === len ? core.unit : core.flatMap(() => writeChunkWriter(idx + 1, len, chunk))(core.write(Chunk.unsafeGet(idx)(chunk))); | ||
}; | ||
@@ -637,0 +637,0 @@ /** @internal */ |
@@ -123,3 +123,3 @@ "use strict"; | ||
this._emitted = this._currentChannel.out; | ||
this._currentChannel = this._activeSubexecutor !== undefined ? undefined : core.unit(); | ||
this._currentChannel = this._activeSubexecutor !== undefined ? undefined : core.unit; | ||
result = ChannelState.Emit(); | ||
@@ -126,0 +126,0 @@ break; |
@@ -255,3 +255,3 @@ "use strict"; | ||
exports.sync = sync; | ||
const unit = () => succeedNow(void 0); | ||
const unit = /*#__PURE__*/succeedNow(void 0); | ||
/** @internal */ | ||
@@ -258,0 +258,0 @@ exports.unit = unit; |
@@ -59,2 +59,5 @@ "use strict"; | ||
exports.isSink = isSink; | ||
const suspend = evaluate => new SinkImpl(core.suspend(() => toChannel(evaluate()))); | ||
/** @internal */ | ||
exports.suspend = suspend; | ||
const as = /*#__PURE__*/(0, _Function.dual)(2, (self, z) => map(() => z)(self)); | ||
@@ -224,5 +227,2 @@ /** @internal */ | ||
exports.contramapChunksEffect = contramapChunksEffect; | ||
const count = () => foldLeftChunks(0, (acc, chunk) => acc + chunk.length); | ||
/** @internal */ | ||
exports.count = count; | ||
const die = defect => failCause(Cause.die(defect)); | ||
@@ -249,3 +249,3 @@ /** @internal */ | ||
exports.dimapChunksEffect = dimapChunksEffect; | ||
const drain = () => new SinkImpl(channel.drain(channel.identityChannel())); | ||
const drain = /*#__PURE__*/new SinkImpl( /*#__PURE__*/channel.drain( /*#__PURE__*/channel.identityChannel())); | ||
/** @internal */ | ||
@@ -267,3 +267,3 @@ exports.drain = drain; | ||
onFailure: core.fail, | ||
onDone: core.unit | ||
onDone: () => core.unit | ||
}); | ||
@@ -283,3 +283,3 @@ /** @internal */ | ||
onFailure: core.fail, | ||
onDone: core.unit | ||
onDone: () => core.unit | ||
}); | ||
@@ -311,3 +311,3 @@ /** @internal */ | ||
onFailure: core.fail, | ||
onDone: core.unit | ||
onDone: () => core.unit | ||
}); | ||
@@ -623,3 +623,3 @@ /** @internal */ | ||
onFailure: core.failCause, | ||
onDone: core.unit | ||
onDone: () => core.unit | ||
}); | ||
@@ -634,3 +634,3 @@ return new SinkImpl(process); | ||
onFailure: core.failCause, | ||
onDone: core.unit | ||
onDone: () => core.unit | ||
}); | ||
@@ -645,3 +645,3 @@ return new SinkImpl(process); | ||
onFailure: core.failCause, | ||
onDone: core.unit | ||
onDone: () => core.unit | ||
}); | ||
@@ -661,5 +661,5 @@ return new SinkImpl(process); | ||
const reader = core.readWith({ | ||
onInput: input => core.flatMap(cont => cont ? reader : core.unit())(core.fromEffect(f(input))), | ||
onInput: input => core.flatMap(cont => cont ? reader : core.unit)(core.fromEffect(f(input))), | ||
onFailure: core.fail, | ||
onDone: core.unit | ||
onDone: () => core.unit | ||
}); | ||
@@ -731,12 +731,4 @@ return new SinkImpl(reader); | ||
exports.mapLeftover = mapLeftover; | ||
const mkString = () => suspend(() => { | ||
const strings = []; | ||
return map(() => strings.join(""))(foldLeftChunks(void 0, (_, elems) => Chunk.map(elems, elem => { | ||
strings.push(String(elem)); | ||
}))); | ||
}); | ||
const never = /*#__PURE__*/fromEffect(Effect.never); | ||
/** @internal */ | ||
exports.mkString = mkString; | ||
const never = () => fromEffect(Effect.never); | ||
/** @internal */ | ||
exports.never = never; | ||
@@ -857,3 +849,3 @@ const orElse = /*#__PURE__*/(0, _Function.dual)(2, (self, that) => new SinkImpl(channel.orElse(() => toChannel(that()))(toChannel(self)))); | ||
exports.succeed = succeed; | ||
const sum = () => foldLeftChunks(0, (acc, chunk) => acc + Chunk.reduce(chunk, 0, (s, a) => s + a)); | ||
const sum = /*#__PURE__*/foldLeftChunks(0, (acc, chunk) => acc + Chunk.reduce(chunk, 0, (s, a) => s + a)); | ||
/** @internal */ | ||
@@ -867,5 +859,2 @@ exports.sum = sum; | ||
exports.summarized = summarized; | ||
const suspend = evaluate => new SinkImpl(core.suspend(() => toChannel(evaluate()))); | ||
/** @internal */ | ||
exports.suspend = suspend; | ||
const sync = evaluate => new SinkImpl(core.sync(evaluate)); | ||
@@ -880,5 +869,2 @@ /** @internal */ | ||
exports.take = take; | ||
const timed = () => map(tuple => tuple[1])(withDuration(drain())); | ||
/** @internal */ | ||
exports.timed = timed; | ||
const toChannel = self => Effect.isEffect(self) ? toChannel(fromEffect(self)) : self.channel; | ||
@@ -928,3 +914,18 @@ /** @internal */ | ||
const channelToSink = self => new SinkImpl(self); | ||
// Constants | ||
/** @internal */ | ||
exports.channelToSink = channelToSink; | ||
const count = /*#__PURE__*/foldLeftChunks(0, (acc, chunk) => acc + chunk.length); | ||
/** @internal */ | ||
exports.count = count; | ||
const mkString = /*#__PURE__*/suspend(() => { | ||
const strings = []; | ||
return map(() => strings.join(""))(foldLeftChunks(void 0, (_, elems) => Chunk.map(elems, elem => { | ||
strings.push(String(elem)); | ||
}))); | ||
}); | ||
/** @internal */ | ||
exports.mkString = mkString; | ||
const timed = /*#__PURE__*/map(tuple => tuple[1])( /*#__PURE__*/withDuration(drain)); | ||
exports.timed = timed; | ||
//# sourceMappingURL=sink.js.map |
{ | ||
"name": "@effect/stream", | ||
"version": "0.30.1", | ||
"version": "0.31.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -253,3 +253,3 @@ /** | ||
*/ | ||
export declare const count: () => Sink<never, never, unknown, never, number>; | ||
export declare const count: Sink<never, never, unknown, never, number>; | ||
/** | ||
@@ -351,3 +351,3 @@ * Creates a sink halting with the specified defect. | ||
*/ | ||
export declare const drain: () => Sink<never, never, unknown, never, void>; | ||
export declare const drain: Sink<never, never, unknown, never, void>; | ||
/** | ||
@@ -881,3 +881,3 @@ * Creates a sink that drops `n` elements. | ||
*/ | ||
export declare const mkString: () => Sink<never, never, unknown, never, string>; | ||
export declare const mkString: Sink<never, never, unknown, never, string>; | ||
/** | ||
@@ -889,3 +889,3 @@ * Creates a sink which never terminates. | ||
*/ | ||
export declare const never: () => Sink<never, never, unknown, never, never>; | ||
export declare const never: Sink<never, never, unknown, never, never>; | ||
/** | ||
@@ -1004,3 +1004,3 @@ * Switch to another sink in case of failure | ||
*/ | ||
export declare const sum: () => Sink<never, never, number, never, number>; | ||
export declare const sum: Sink<never, never, number, never, number>; | ||
/** | ||
@@ -1043,3 +1043,3 @@ * Summarize a sink by running an effect when the sink starts and again when | ||
*/ | ||
export declare const timed: () => Sink<never, never, unknown, never, Duration.Duration>; | ||
export declare const timed: Sink<never, never, unknown, never, Duration.Duration>; | ||
/** | ||
@@ -1046,0 +1046,0 @@ * Creates a sink produced from an effect. |
@@ -227,3 +227,3 @@ import type * as Context from "@effect/data/Context" | ||
undefined : | ||
core.unit()) as core.Primitive | undefined | ||
core.unit) as core.Primitive | undefined | ||
result = ChannelState.Emit() | ||
@@ -230,0 +230,0 @@ break |
@@ -989,3 +989,3 @@ import * as Chunk from "@effect/data/Chunk" | ||
/** @internal */ | ||
export const unit = (): Channel.Channel<never, unknown, unknown, unknown, never, never, void> => succeedNow(void 0) | ||
export const unit: Channel.Channel<never, unknown, unknown, unknown, never, never, void> = succeedNow(void 0) | ||
@@ -992,0 +992,0 @@ /** @internal */ |
@@ -318,3 +318,3 @@ /** | ||
*/ | ||
export const count: () => Sink<never, never, unknown, never, number> = internal.count | ||
export const count: Sink<never, never, unknown, never, number> = internal.count | ||
@@ -432,3 +432,3 @@ /** | ||
*/ | ||
export const drain: () => Sink<never, never, unknown, never, void> = internal.drain | ||
export const drain: Sink<never, never, unknown, never, void> = internal.drain | ||
@@ -1113,3 +1113,3 @@ /** | ||
*/ | ||
export const mkString: () => Sink<never, never, unknown, never, string> = internal.mkString | ||
export const mkString: Sink<never, never, unknown, never, string> = internal.mkString | ||
@@ -1122,3 +1122,3 @@ /** | ||
*/ | ||
export const never: () => Sink<never, never, unknown, never, never> = internal.never | ||
export const never: Sink<never, never, unknown, never, never> = internal.never | ||
@@ -1269,3 +1269,3 @@ /** | ||
*/ | ||
export const sum: () => Sink<never, never, number, never, number> = internal.sum | ||
export const sum: Sink<never, never, number, never, number> = internal.sum | ||
@@ -1321,3 +1321,3 @@ /** | ||
*/ | ||
export const timed: () => Sink<never, never, unknown, never, Duration.Duration> = internal.timed | ||
export const timed: Sink<never, never, unknown, never, Duration.Duration> = internal.timed | ||
@@ -1324,0 +1324,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3419146
57772