MCPcopy Index your code
hub / github.com/Effect-TS/effect / foldWeightedDecompose

Function foldWeightedDecompose

packages/effect/src/internal/sink.ts:1112–1133  ·  view source on GitHub ↗
(
  options: {
    readonly initial: S
    readonly maxCost: number
    readonly cost: (s: S, input: In) => number
    readonly decompose: (input: In) => Chunk.Chunk<In>
    readonly body: (s: S, input: In) => S
  }
)

Source from the content-addressed store, hash-verified

1110
1111/** @internal */
1112export const foldWeightedDecompose = <S, In>(
1113 options: {
1114 readonly initial: S
1115 readonly maxCost: number
1116 readonly cost: (s: S, input: In) => number
1117 readonly decompose: (input: In) => Chunk.Chunk<In>
1118 readonly body: (s: S, input: In) => S
1119 }
1120): Sink.Sink<S, In, In> =>
1121 suspend(() =>
1122 new SinkImpl(
1123 foldWeightedDecomposeLoop(
1124 options.initial,
1125 0,
1126 false,
1127 options.maxCost,
1128 options.cost,
1129 options.decompose,
1130 options.body
1131 )
1132 )
1133 )
1134
1135/** @internal */
1136const foldWeightedDecomposeLoop = <S, In>(

Callers 1

foldWeightedFunction · 0.85

Calls 2

suspendFunction · 0.70

Tested by

no test coverage detected