TensorFile.read_all: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/tensor_file.bend as TensorFile Lines 102-111 of stelliferous@0.0.2.0/tensor_file.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/tensor_file.bend&start_line=102&end_line=111 import Base # A file longer than its shape stops at the fuel and fails the count. def read_all(fuel: Nat,reading: Reading,+count: U32) -> IO(Outcome): match fuel reading: case 0n More{file,target}: closed(file,target,True{}) case 0n End{file,target,complete}: closed(file,target,complete) case 1n+rest End{file,target,complete}: closed(file,target,complete) case 1n+rest More{file,target}: do IO: read : Read() <- File.read_bytes(file,(chunk() * 4 : U32)) read_all(rest,taken(read,target,count),count) Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=File.read_bytes https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mul https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_file.bend&name=Outcome https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_file.bend&name=Read https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_file.bend&name=Reading https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_file.bend&name=chunk https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_file.bend&name=closed https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_file.bend&name=taken