From 718554cb2e3135aede46061ef67940a7aa5fa1b0 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Mon, 23 Feb 2026 11:22:11 +0000 Subject: [PATCH] Bump `hs-bindgen` for record-dot support --- cabal.project | 14 +++++++------- flake.nix | 1 + lib/GarnetRs/Raw.hs | 1 + lib/GarnetRs/Wrapped.hs | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cabal.project b/cabal.project index 52115f5..2f00410 100644 --- a/cabal.project +++ b/cabal.project @@ -1,19 +1,19 @@ packages: . --- https://well-typed.com/blog/2026/02/hs-bindgen-alpha --- Haskell.nix doesn't seem to like `tag: release-0.1-alpha`, which the blog post suggests --- so we specify the equivalent commit SHAs manually instead +-- not on Hackage yet: https://well-typed.com/blog/2026/02/hs-bindgen-alpha +-- we've modified the stanzas from that post in order to use a more recent version +-- because we want record-dot support: https://github.com/well-typed/hs-bindgen/issues/1829#issuecomment-4081875451 source-repository-package type: git location: https://github.com/well-typed/hs-bindgen - tag: e2a9260678d9fa76dab602a5a07927acada3be4f + tag: 6ca94188abd756a1fb4dd8a4037de3fa7dca0765 subdir: c-expr-dsl c-expr-runtime hs-bindgen hs-bindgen-runtime - --sha256: 0nrs3iq0l5ha5kxyhqnlmvgi7734pmzyp3zf7p8s1gb21ylh4sy0 + --sha256: M+8tEZA8gsEc6gXnNdSbRpMBQ5LkH7sphcV1aR0fclA= source-repository-package type: git location: https://github.com/well-typed/libclang - tag: b5ff712c91c039cde6720ffe2096a121d9f4d802 - --sha256: 1lwjdxd2ahhkvyxrpli7z9z7ss4l94m2jaif8kg1i2yygbhksrb3 + tag: d6e482df49b88375cf3075928a78ee86c2a068d4 + --sha256: 175kjba915bh50wf03gi88njz03jp0n3wp7yq73hznkaly6bpwal allow-newer: *:base, diff --git a/flake.nix b/flake.nix index 2e86003..1ab4d99 100644 --- a/flake.nix +++ b/flake.nix @@ -54,6 +54,7 @@ bacon ghcid llvmPackages.libclang + llvmPackages.llvm rust-analyzer rust-cbindgen ]; diff --git a/lib/GarnetRs/Raw.hs b/lib/GarnetRs/Raw.hs index 6344ff2..a3d8b80 100644 --- a/lib/GarnetRs/Raw.hs +++ b/lib/GarnetRs/Raw.hs @@ -41,6 +41,7 @@ do withHsBindgen def { clang = def{extraIncludeDirs = Pkg "rust/target/debug" : systemDirs} + , fieldNamingStrategy = EnableRecordDot } def $ hashInclude "garnet_rs.h" diff --git a/lib/GarnetRs/Wrapped.hs b/lib/GarnetRs/Wrapped.hs index 0837fa3..4ad72c2 100644 --- a/lib/GarnetRs/Wrapped.hs +++ b/lib/GarnetRs/Wrapped.hs @@ -27,7 +27,7 @@ data T = T , b :: Word8 } convertT :: T -> Raw.T -convertT T{a, b} = Raw.T{t_a = fromBool a, t_b = b} +convertT T{a, b} = Raw.T{a = fromBool a, b} data Shape = Circle CDouble