Hsrs
Type-Safe Haskell Bindings Generator for Rust
Get picks like this daily. Today's launch numbers, the top launches, AI and tech news, and a daily opportunity pick, straight to your inbox.
Want to reach these readers? Sponsor an issue.
Hey everyone! I've been working on hsrs, a type-safe Haskell Bindings Generator for Rust.I couldn't really find any bindings generator that would create type-safe, rich bindings for Haskell from Rust. Naturally, both languages have rich type systems, so I was amazed that no awesome bindings generator already existed, hence I decided to write my own. hsrs feels very similar to pyo3 and napi-rs, and if you've used those, hsrs will feel right at home.What's unique about hsrs as opposed to hs-bindgen is that it has type-safe bindings for rich types, like Result, Maybe, etc. while also generating Haskell bindings. The repo contains a minimal example, and more details are available in the haskell discourse: https://discourse.haskell.org/t/ann-hsrs-ergonomic-haskell-b...
HN · launched May 19, 2026 · 53 upvotes (top 16%) · 0 views
Niche: api generation and management tools · 64 launches, 1 in the last 7 days ▼ -80% · Explore this niche →
Category and tags
- Horizontal
- Dev tools
- Developer
- Not AI
- Hobby / open-source project
Visit website ↗ Source listing ↗
More like this: all 64 launches in api generation and management tools →
Could you build this?
No Building a cross-language FFI binding generator between Rust and Haskell requires deep compiler engineering and mastery of both languages' type systems, memory layouts, and ABIs.
What it would actually take: The tool must parse Rust ASTs (via syn), inspect C ABI representations, map complex algebraic data types to Haskell FFI conventions, and generate matching Haskell/C code with correct memory management (handles, pointers, finalizers). The hard parts include handling non-trivial generic lifetimes, safe concurrency, and exception boundaries between Haskell's GHC runtime and Rust. This requires deep compiler and language runtime expertise.
Discussion
9 comments analyzed.
Competitors mentioned: napi-rs, pyo3, ocaml-rs, JSC internal bindings
Concerns raised: Panics across FFI boundary cause runtime crash (UB behavior), GC friction between languages makes performance optimization difficult, Monomorphization makes translating generic Rust functions unclear, Type system guarantees don't transfer across language boundaries
Feature requests: Generate bindings for existing Rust library types without custom wrappers, Mark functions as pure to avoid IO wrapper overhead, Translate Rust traits/type classes to Haskell, Automated purity detection (const fn, creusot support)
Competitors
Other products that read as similar to this one : 263 launches clear the similarity bar, closest 8 shown.
Attention rank: #58 of 264 (itself plus its competitors, highest first, normalized so YC and Product Hunt are compared fairly).
Launched 199 days after the earliest competitor.
- Genotype: language that compiles to idiomatic TS, Rust and Python · hn · 2026-09-08 · 9 upvotes · similarity 0.52
- Fuse · hn · 2026-08-02 · 121 upvotes · similarity 0.46
- tsrs · github · 2026-10-01 · 13 upvotes · similarity 0.45
- Typical is TypeScript with type-safety at runtime · hn · 2026-01-11 · 8 upvotes · similarity 0.45
- Typol · hn · 2026-06-07 · 5 upvotes · similarity 0.43
- typesafe-ai · github · 2026-09-16 · 10 upvotes · similarity 0.42
- ErisLint · github · 2026-09-18 · 18 upvotes · similarity 0.42
- Mirror_bridge · hn · 2025-12-04 · 29 upvotes · similarity 0.42
The niche, labels, vibe code rating and competitor comparison on this page are analysis by Nicheloom. If you use them, please credit nicheloom.com. How you may use our data.