VisibleCursor.preview.loop: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend as VisibleCursor Lines 490-520 of mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend&start_line=490&end_line=520 import Base def preview.loop(fuel: Nat, state: PreviewState) -> IO(Preview): match fuel: case 0n: match state: case PreviewNeed{cursor}: IO.pure(Preview, PreviewFailed{cursor}) case PreviewRead{step}: match step: case Item{_, cursor}: IO.pure(Preview, PreviewFailed{cursor}) case Skip{cursor}: IO.pure(Preview, PreviewFailed{cursor}) case End{}: IO.pure(Preview, PreviewEnded{Ended{}}) case Error{error}: IO.pure(Preview, PreviewFailed{Failed{error}}) case 1n+rest: match state: case PreviewNeed{cursor}: do IO: step : Step <- next(cursor) preview.loop(rest, PreviewRead{step}) case PreviewRead{step}: match step: case Item{entry, advanced}: IO.pure(Preview, preview.item(entry, advanced)) case Skip{advanced}: preview.loop(rest, PreviewNeed{advanced}) case End{}: IO.pure(Preview, PreviewEnded{Ended{}}) case Error{error}: IO.pure(Preview, PreviewFailed{Failed{error}}) Uses (10): 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=mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend&name=Cursor https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend&name=Preview https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend&name=PreviewState https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend&name=Step https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend&name=next https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/scan/VisibleCursor.bend&name=preview.item