def slurp
import bolt@1.27.0.0/src/lsp/files/disk.bend as Diskimport Base
48# the whole file, read in chunks until one is empty, or the fuel is
49def slurp(fuel: Nat, file: File, acc: List<&2, U32>) -> IO(Maybe<&2, String>): # noqa: L001 disk effect
50 match fuel:
51 case 0n:
52 slurp.end(file, acc)
53 case 1n+f:
54 do IO<Maybe<&2, String>>:
55 got : File & Result<&1, &1, U32 & String, List<&2, U32>> <- File.read_bytes(file, 65536)
56 slurp.next(got, acc, fl => a => slurp(f, fl, a))