def sys.read.opened
import ezsys@0.1.0.0/src/sys.bend as Sysimport Base
92# an opened file is sized and read; a failed open is the answer
93def sys.read.opened(
94 res: Result<&1, &1, U32 & String, File>
95) -> IO(Result<&1, &1, U32 & String, String>):
96 match res:
97 case Fail{error}:
98 IO.pure(Result<&1, &1, U32 & String, String>, Fail{error})
99 case Done{file}:
100 IO.bind(File & Result<&1, &1, U32 & String, U32>,
101 Result<&1, &1, U32 & String, String>, File.size(file), sys.read.sized)