Fs.write_words.loop: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/Fs.bend as Fs Lines 116-158 of mylsm-lsm-store@0.6.0.1/src/Fs.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/Fs.bend&start_line=116&end_line=158 import Base import mylsm-lsm-store@0.6.0.1/src/FilesCompat.bend as PackedFiles def write_words.loop( fuel: Nat, state: WriteWordsState ) -> IO(File & Result<&1, &1, U32 & String, Unit>): match fuel: case 0n: match state: case WriteWordsNeed{file, _, _, _, empty}: match empty: case True{}: IO.pure(File & Result<&1, &1, U32 & String, Unit>, (file, Done{Unit{}})) case False{}: IO.pure(File & Result<&1, &1, U32 & String, Unit>, (file, Fail{(7, "write ran out of bounded progress steps")})) case WriteWordsFailed{file, error}: IO.pure(File & Result<&1, &1, U32 & String, Unit>, (file, Fail{error})) case WriteWordsNoProgress{file}: IO.pure(File & Result<&1, &1, U32 & String, Unit>, (file, Fail{(5, "write made no progress")})) case 1n+rest: match state: case WriteWordsNeed{file, (for_write_offset, for_read_offset), (for_write, for_read), words, empty}: match empty: case True{}: IO.pure(File & Result<&1, &1, U32 & String, Unit>, (file, Done{Unit{}})) case False{}: do IO>: pair : File & Result<&1, &1, U32 & String, U32 & Array> <- PackedFiles.write.words.once(file, for_write_offset, U32.min(65536, for_write), words) write_words.loop(rest, write_words.after(pair, for_read_offset, for_read)) case WriteWordsFailed{file, error}: IO.pure(File & Result<&1, &1, U32 & String, Unit>, (file, Fail{error})) case WriteWordsNoProgress{file}: IO.pure(File & Result<&1, &1, U32 & String, Unit>, (file, Fail{(5, "write made no progress")})) Uses (17): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=File https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat 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 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.min https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/FilesCompat.bend&name=write.words.once https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/Fs.bend&name=WriteWordsState https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/Fs.bend&name=write_words.after