Postgres.read.loop: def of bend-kit-postgres@0.3.0.0 Import: import bend-kit-postgres@0.3.0.0/postgres.bend as Postgres Lines 156-183 of bend-kit-postgres@0.3.0.0/postgres.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-postgres@0.3.0.0/postgres.bend&start_line=156&end_line=183 import Base import bend-kit-postgres@0.3.0.0/codec.bend as Codec # One recv per step. NoticeResponse and ParameterStatus may arrive at any time; they are skipped. def read.loop(fuel: Nat, st: Rd) -> IO(Result<&1, &1, Failure, Conn & Codec.Back>): match fuel: case 0n: match st: case RNext{tls, sock, key, ms, status, r}: read.fail(tls, sock, Malformed{}) case RFail{tls, sock, why}: read.fail(tls, sock, why) case 1n+f: match st: case RFail{tls, sock, why}: read.fail(tls, sock, why) case RNext{+tls, sock, +key, +ms, +status, r}: (rd, nx) = r match nx: case Codec.Got{Codec.NoticeResponse{fs}}: read.loop(f, RNext{tls, sock, key, ms, status, Codec.next(rd)}) case Codec.Got{Codec.ParameterStatus{name, value}}: read.loop(f, RNext{tls, sock, key, ms, status, Codec.next(rd)}) case Codec.Got{m}: IO.pure(Result<&1, &1, Failure, Conn & Codec.Back>, Done{(Conn{tls, sock, rd, key, ms, status}, m)}) case Codec.Bad{}: read.fail(tls, sock, Malformed{}) case Codec.Want{}: do IO>: m : Socket & Result<&1, &1, U32 & String, U32 & Array> <- io.recv(tls, sock, ms) read.loop(f, got(tls, key, ms, status, rd, m)) Uses (20): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array 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=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Socket https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/codec.bend&name=Back https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/codec.bend&name=Next https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/codec.bend&name=next https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/postgres.bend&name=Conn https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/postgres.bend&name=Failure https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/postgres.bend&name=Rd https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/postgres.bend&name=got https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/postgres.bend&name=io.recv https://jend.leeeet.dev/definition.txt?path=bend-kit-postgres@0.3.0.0/postgres.bend&name=read.fail