TraceContext.Drive.fed: def of bend-trace-context@0.2.0.0 Import: import bend-trace-context@0.2.0.0/trace_context.bend as TraceContext Lines 953-965 of bend-trace-context@0.2.0.0/trace_context.bend: https://jend.leeeet.dev/read.txt?path=bend-trace-context@0.2.0.0/trace_context.bend&start_line=953&end_line=965 import Base # The driver of the three machines: a trace ID draw, a span ID draw and a # generation. It feeds a machine one source word at a time while the # machine's step waits for one, and stops as soon as it has ended. Each # machine gives, as templates, `waiting`, the draw that a step feeds its next # word to, if it waits for one, and `feed`, the step after that word. The # driver keeps each step beside what `waiting` says of it. # # Feed a word that a source returned, keeping the source's next state. def Drive.fed(~T: Data, ~D: Data, ~waiting: T -> Maybe<&2, D>, ~feed: Result<&1, &1, U32 & String, U32> -> D -> T, -S: Type, got: S & Result<&1, &1, U32 & String, U32>, draw: D) -> S & (T & Maybe<&2, D>): (state, word) = got +next = feed(word, draw) (state, (next, waiting(next))) Uses (6): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32