def read.opened
import ezx@1.11.0.0/src/io/file.bend as Fileimport Base
83# what an opened file holds, or nothing when it would not open
84def read.opened(res: Result<&1, &1, U32 & String, File>) -> IO(Maybe<&2, String>):
85 match res:
86 case Fail{_e}:
87 IO.pure(Maybe<&2, String>, None{})
88 case Done{file}:
89 do IO<Maybe<&2, String>>:
90 got : File & Result<&1, &1, U32 & String, U32> <- File.size(file)
91 text : String <- read.sized(got)
92 return Some{text}