66 Commits

Author SHA1 Message Date
George Thomas
a9c69c4927 Add maybe/optional example 2026-04-14 00:45:15 +01:00
George Thomas
14e0e85823 Add vector/slice example 2026-04-14 00:45:15 +01:00
George Thomas
ca99358747 Remove unnecessary Rust unit return type annotations 2026-04-14 00:45:15 +01:00
George Thomas
81793d5171 Pass all non-primitive types by (immutable) reference 2026-04-14 00:45:15 +01:00
George Thomas
ea096b6945 Deduplicate base dependency 2026-04-14 00:45:15 +01:00
George Thomas
356385cbd2 Get Rust Analyzer from overlay instead of directly from Nixpkgs
Right now, the latter invokes `cargo metadata --lockfile-path`,
which this Cargo nightly doesn't support.
2026-04-14 00:45:15 +01:00
George Thomas
e2854bd486 Reformat 2026-04-14 00:45:15 +01:00
George Thomas
57518cc3dc Remove unnecessary library linking 2026-04-14 00:45:15 +01:00
George Thomas
b2eaaf6b88 Specify include directories via environment variable 2026-04-14 00:45:15 +01:00
George Thomas
351640dc7a Minor refactor to avoid long line 2026-04-14 00:45:15 +01:00
George Thomas
987fc65a34 Combine overrides 2026-04-14 00:45:15 +01:00
George Thomas
705d604fdb Inline project Nix file 2026-04-14 00:45:15 +01:00
George Thomas
6f58488033 Remove unused binding 2026-04-14 00:45:15 +01:00
George Thomas
00ffcc3df9 Simplify build script
Seeing as we now no longer need to modify generated header files.
2026-04-14 00:45:15 +01:00
George Thomas
963b90f627 wip: file dependency reload stuff 2026-04-14 00:43:52 +01:00
George Thomas
322ad4ee73 wip: use upstream fix to avoid header patching hack...
argh, unrelated breaking change, and bad names

a few bits of this should be split up
2026-04-14 00:37:22 +01:00
George Thomas
958332857d wip: stuff from Yuri (maybe squash?)...
things I've changed from the PR:
- dropped legacy (i.e. non-flake) compat stuff, which turns out to account for most of the diff
- dropped `packages.garnet` since it doesn't work with `nix build .#garnet`
- back to using Rust-extended packages everywhere, which _seems_ fine
the rest is just re-inlining things and other refactors

note that changes we keep are essentially:
- not using Crane's extended packages everywhere
- bumping `nix-haskell` to avoid shell hook workaround
- various changes in how we call `nix-haskell`
- using `libCgarnet_rs` name, which Cabal expects
- adding proper non-dev-shell targets, so that e.g. `nix run` works

stuff we should still take a look at:
- seems a bit weird that `garnet-rs` arg to `project.nix` was always same (and therefore now we always pass the ) - might be a mistake, and we're supposed to be using local for local build?
- similar `libCgarnet_rs.a` logic appears in three places - see if we can deduplicate to some extent somehow
- I haven't even checked all steps are necessary
2026-04-14 00:37:18 +01:00
George Thomas
c228354a13 Use nix-haskell and provide source-repository-packages to Cabal in shell 2026-03-24 16:01:44 +00:00
George Thomas
52f0a49d87 Fix build script to work correctly on clean checkout 2026-03-24 15:29:36 +00:00
George Thomas
df1f73eb8a Script the full build 2026-03-24 11:24:40 +00:00
George Thomas
6bb06b117f Symlink static lib instead of copying
This means we need to run the script much less often.
2026-03-24 11:24:40 +00:00
George Thomas
649c1b466f Revert "Ditch Bash script for custom setup"
This reverts commit 1f1c0d959da699ce04f7951ecbcdb7976c8c0750.

This doesn't work well with multi-component builds. For example, it requires `"haskell.sessionLoading": "singleComponent"` in VSCode, which makes HLS work less reliably.
2026-03-24 11:24:40 +00:00
George Thomas
b79a4c0804 Ditch Bash script for custom setup 2026-03-24 11:24:40 +00:00
George Thomas
b68d6257d3 Move bindings generation to Rust build script 2026-03-24 11:24:40 +00:00
George Thomas
b94e8ef11b Make staged imports consistent 2026-03-24 11:24:40 +00:00
George Thomas
4ecd0b16e2 Drop build hooks in favour of just using bundled libraries properly
The script addition is a bit hacky, but there's no obvious straightforward arch/version-independent way to get most of the build path. And eventually, once issues with HLS etc. are sorted out we will revert to using Cabal hooks anyway.
2026-03-23 23:06:29 +00:00
George Thomas
ddb9c300cf Switch to Hooks API instead of using cabal configure hack for lib/include dirs 2026-03-23 22:57:34 +00:00
George Thomas
718554cb2e Bump hs-bindgen for record-dot support 2026-03-19 11:34:50 +00:00
George Thomas
a018cc389a Generate header in Rust build output directory 2026-02-20 09:53:12 +00:00
George Thomas
96ec5c1cb1 Switch to Template Haskell mode for hs-bindgen 2026-02-20 09:08:16 +00:00
George Thomas
20b47594c6 Avoid IO for tree sum 2026-02-19 21:35:35 +00:00
George Thomas
71e4ffaede Make Rust tree type polymorphic 2026-02-19 21:28:00 +00:00
George Thomas
58005ee261 Refactor to use continuation monad 2026-02-19 21:18:37 +00:00
George Thomas
ca063b1dd6 Rename tree types 2026-02-19 21:11:58 +00:00
George Thomas
261acca8a4 Define nicer Rust tree type and coerce 2026-02-19 21:11:23 +00:00
George Thomas
55a781eeb8 Add tree example 2026-02-19 20:44:04 +00:00
George Thomas
06767e17ea Add newline for consistency 2026-02-19 19:37:46 +00:00
George Thomas
2a80e5b219 Minor simplification 2026-02-19 17:22:15 +00:00
George Thomas
e977181252 Avoid typedefs
This makes the header simpler, and silences `hs-bindgen` notices about "squashed" typedefs.
2026-02-19 17:22:15 +00:00
George Thomas
9ca4f615d8 Use simpler tagged union translation
Avoids the worst part of the header hack, and makes Haskell wrapper simpler.
2026-02-19 17:22:15 +00:00
George Thomas
5019af701f Mark pure function 2026-02-19 17:22:15 +00:00
George Thomas
5907a064a7 Use fixed-width integers
Even though `Int` and `isize` should be the same in practice, we can't cleanly convert, as the type information isn't quite there. And anyway, strictly speaking per the report, `Int` is only guaranteed to hold 30 bits.

Note that this is essentially unchanged even if we specify `usize_is_size_t = true` for `cbindgen`.
2026-02-19 17:19:28 +00:00
George Thomas
024b6aec87 Implement function with return value 2026-02-19 16:29:52 +00:00
George Thomas
40bb939302 Stick to Rust debug builds in shell to avoid C lib dir confusion 2026-02-19 16:29:52 +00:00
George Thomas
ddc8b9097d Avoid absolute path hack 2026-02-19 16:29:52 +00:00
George Thomas
25875c7dc1 Move Haskell package to top level 2026-02-19 16:29:52 +00:00
George Thomas
2bab0ff94e Rename Haskell.nix flake input 2026-02-19 16:29:52 +00:00
George Thomas
7d90990b74 Bump flake inputs 2026-02-19 16:29:52 +00:00
George Thomas
56370bb8a4 Reformat 2026-02-19 16:29:52 +00:00
George Thomas
b9e2e59174 Refactor Nix flake inputs 2026-02-19 16:29:52 +00:00