def sys.read.go

ezsys@0.1.0.0 · src/sys.bend:65

import ezsys@0.1.0.0/src/sys.bend as Sys
import Base
import ezsys@0.1.0.0/src/step.bend as Step

65# read chunks until an empty one; fuel first, so the call is a decreasing one
66def sys.read.go(
67  fuel: Nat,
68  file: File,
69  got: String,
70  +chunk: U32
71) -> IO(Result<&1, &1, U32 & String, String>):
72  match fuel:
73    case 0n:
74      sys.read.end(file, Step.read.spent())
75    case 1n+f:
76      IO.bind(File & Result<&1, &1, U32 & String, String>,
77        Result<&1, &1, U32 & String, String>,
78        File.read(file, chunk),
79        pair => sys.read.un(got, fl => g => sys.read.go(f, fl, g, chunk), pair))

Uses (12)

Used by (1)