def read.sized2

cswap-bend-cli@0.1.0.0 · fs.bend:61

import cswap-bend-cli@0.1.0.0/fs.bend as Fs
import Base

61def read.sized2(f: File, r: Res(U32)) -> IO(Res(String)):
62  match r:
63    case Fail{e}:
64      IO.bind(Unit, Res(String), File.close(f), u => IO.pure(Res(String), Fail{e}))
65    case Done{n}:
66      IO.bind(File & Res(String), Res(String), File.read(f, n), read.done)

Uses (13)

Used by (1)