Server.serve.for: def of gralha-http-server@0.1.0.0 Import: import gralha-http-server@0.1.0.0/server.bend as Server Lines 150-159 of gralha-http-server@0.1.0.0/server.bend: https://jend.leeeet.dev/read.txt?path=gralha-http-server@0.1.0.0/server.bend&start_line=150&end_line=159 import Base import gralha-http-core@0.1.0.0/http.bend as Http # Serves n connections, then hands back the listener and the state. def serve.for(~S: Type, ~handle: Http.Request -> S -> IO(S & Http.Response), n: Nat, listener: Listener, state: S, +max: U32) -> IO(Listener & S): match n: case 0n: IO.pure(Listener & S, (listener, state)) case 1n+p: do IO: got : Listener & S <- step(~S, ~handle, listener, state, max) loop.next(S, got, l => s => serve.for(~S, ~handle, p, l, s, max)) Uses (12): 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=Listener 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=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=gralha-http-core@0.1.0.0/http.bend&name=Request https://jend.leeeet.dev/definition.txt?path=gralha-http-core@0.1.0.0/http.bend&name=Response https://jend.leeeet.dev/definition.txt?path=gralha-http-server@0.1.0.0/server.bend&name=loop.next https://jend.leeeet.dev/definition.txt?path=gralha-http-server@0.1.0.0/server.bend&name=step