Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions bench/main.bend
Original file line number Diff line number Diff line change
Expand Up @@ -76,36 +76,36 @@ def die.msg(msg: String) -> IO(Unit):
IO.die(Unit, 1, msg)

# command plus three words; further words are ignored
def argv.3(a: String, b: String, c: String, xs: List<String>) -> String & String & String & String:
def argv.w3(a: String, b: String, c: String, xs: List<String>) -> String & String & String & String:
match xs:
case Nil{}:
(a, b, c, "")
case d <> t:
(a, b, c, d)

# third word
def argv.2(a: String, b: String, xs: List<String>) -> String & String & String & String:
def argv.w2(a: String, b: String, xs: List<String>) -> String & String & String & String:
match xs:
case Nil{}:
(a, b, "", "")
case c <> t:
argv.3(a, b, c, t)
argv.w3(a, b, c, t)

# second word
def argv.1(a: String, xs: List<String>) -> String & String & String & String:
def argv.w1(a: String, xs: List<String>) -> String & String & String & String:
match xs:
case Nil{}:
(a, "", "", "")
case b <> t:
argv.2(a, b, t)
argv.w2(a, b, t)

# split argv in one walk (the list is affine)
def argv.0(xs: List<String>) -> String & String & String & String:
def argv.w0(xs: List<String>) -> String & String & String & String:
match xs:
case Nil{}:
("", "", "", "")
case a <> t:
argv.1(a, t)
argv.w1(a, t)

# plain text content type
def ctype.plain() -> String:
Expand Down Expand Up @@ -610,7 +610,7 @@ def main.go.un(quad: String & String & String & String) -> IO(Unit):

# unpack argv and run the named command
def main.go(args: List<String>) -> IO(Unit):
main.go.un(argv.0(args))
main.go.un(argv.w0(args))

# CLI entry
def main() -> IO(Unit):
Expand Down
2 changes: 1 addition & 1 deletion ezhttp/effs/wire.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,5 @@ Term ezwire_talk_run(Env e, Term* f, IoWork* w) {
}

static void __attribute__((constructor)) ezwire_talk_use(void) {
io_eff(CID_EZWIRE_TALK, ezwire_talk_run, 0);
io_eff(CID(ezwire.talk), ezwire_talk_run, 0);
}
7 changes: 5 additions & 2 deletions ezhttp/effs/wire.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
// same way too, with dlopen at run time, because neither lane has a link line
// that could name -lssl.
//
// Every name here is a `function`, never a top-level `const`: each effect's JS
// lands in one concatenated script, and a redeclared `const` there is fatal.
// The file runs once in a closure of its own and registers the effect at its
// foot with io_eff, as wire.c does. The helpers are still `function`s and the
// loaded libraries still live on globalThis, so each is opened once per process.

// libc's resolver. io_sys() already carries the socket calls; getaddrinfo is
// the one it does not, and it is the whole of ez's DNS.
Expand Down Expand Up @@ -259,3 +260,5 @@ function ezwire_talk(spec) {
io_sys().close(fd);
return out;
}

io_eff(CID(ezwire.talk), ezwire_talk);
47 changes: 40 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
inputs.ez = {
url = "github:Emerging-Patterns/ez";
inputs.nixpkgs.follows = "nixpkgs";
inputs.bend.follows = "bend";
# not `inputs.bend.follows = "bend"`: ez 1.2.0 does not build on bend
# 2.0.28, so ez (and `ez prove`, and bolt through mkLint) keep the bend
# ez 1.2.0 locks, 2.0.27
inputs.bend.url = "github:bendlang/bend/d37909174ebd664338ae3194799a9e0899dedd51";
};

outputs = { self, nixpkgs, ... }@inputs:
Expand All @@ -20,7 +23,7 @@
ez = inputs.ez.lib.${system};
ezBin = inputs.ez.packages.${system}.default;
bend = inputs.bend.packages.${system}.default;
bolt = ez.toolPackage { name = "bolt"; src = self; inherit bend; wrapFlags = [ "--gpu" "off" ]; };
bolt = ez.toolPackage { name = "bolt"; src = self; wrapFlags = [ "--gpu" "off" ]; };
bend-cc = ez.bend-cc;

bench = import ./bench {
Expand Down
Loading