Interaction Trees in Zig and simple benchmarks

This commit is contained in:
2026-05-15 21:41:19 -05:00
parent e3dcf5edd7
commit 8d5e76db1c
17 changed files with 2179 additions and 81 deletions

View File

@@ -26,6 +26,18 @@
haskellPackages.callCabal2nix packageName self {}
);
tricuBench =
hsLib.overrideCabal
(hsLib.doBenchmark (
haskellPackages.callCabal2nix packageName self {}
))
(oldAttrs: {
postInstall = (oldAttrs.postInstall or "") + ''
mkdir -p $out/bin
cp dist/build/tricu-bench/tricu-bench $out/bin/
'';
});
customGHC = haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [
megaparsec
]);
@@ -37,7 +49,8 @@
pname = "tricu-zig";
version = "0.1.0";
src = ./ext/zig;
nativeBuildInputs = [ pkgs.zig ];
nativeBuildInputs = [ pkgs.zig pkgs.pkg-config ];
buildInputs = [ pkgs.libuv ];
buildPhase = ''
export ZIG_GLOBAL_CACHE_DIR=$TMPDIR/zig-cache
zig build
@@ -55,6 +68,7 @@
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ pkgs.gcc pkgs.python3 tricuZig ];
buildInputs = [ pkgs.libuv ];
buildPhase = "true";
doCheck = true;
checkPhase = ''
@@ -69,6 +83,18 @@
-Wl,-rpath,${tricuZig}/lib
/tmp/c_abi_test
# IO protocol shape test
gcc -o /tmp/io_protocol_test tests/io_protocol_test.c \
-I ${tricuZig}/include -L ${tricuZig}/lib -larboricx \
-Wl,-rpath,${tricuZig}/lib
/tmp/io_protocol_test
# IO run test (synchronous driver)
gcc -o /tmp/io_run_test tests/io_run_test.c \
-I ${tricuZig}/include -L ${tricuZig}/lib -larboricx \
-Wl,-rpath,${tricuZig}/lib
/tmp/io_run_test
# Kernel path append test
gcc -o /tmp/c_abi_append_test tests/c_abi_append_test.c \
-I ${tricuZig}/include -L ${tricuZig}/lib -larboricx \
@@ -195,6 +221,7 @@
in {
packages.${packageName} = tricuPackage;
packages.default = tricuPackage;
packages.tricu-bench = tricuBench;
packages.tricu-zig = tricuZig;
packages.tricu-zig-tests = tricuZigTests;
packages.tricu-php = tricuPhp;