Hsrs
Type-Safe Haskell Bindings Generator for Rust
Details
- External ID
- 48189044
- Source
- HN
- Company
- —
- Product
- Hsrs
- Website domain
- github.com
- Launched
- May 19, 2026
- Cohort
- —
- Upvotes
- 53
- Upvotes percentile
- 0.8449111470113085
- Tags
- —
- Fetched at
- Sept. 7, 2026, 9:26 p.m.
- Updated at
- Sept. 7, 2026, 9:26 p.m.
Description
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...
Enrichment
- Theme
- database infrastructure and developer tools
- Vertical
- Horizontal
- Function
- Dev tools
- Audience
- Developer
- AI stance
- Not AI
- Project type
- Hobby / open-source project
- Normalized one-liner
- haskell bindings generator for rust
- Manually corrected
- False
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 — 134 launches clear the similarity bar, closest 8 shown.
Attention rank: #29 of 135 (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.51
- Fuse · hn · 2026-08-02 · 121 upvotes · similarity 0.44
- Typical is TypeScript with type-safety at runtime · hn · 2026-01-11 · 8 upvotes · similarity 0.44
- Typol · hn · 2026-06-07 · 5 upvotes · similarity 0.41
- typesafe-ai · github · 2026-09-16 · 10 upvotes · similarity 0.40
- Pg-typesafe · hn · 2026-02-17 · 69 upvotes · similarity 0.40
- Topaz · hn · 2026-06-18 · 5 upvotes · similarity 0.40
- ErisLint · github · 2026-09-18 · 18 upvotes · similarity 0.40
Other launches for this product
- No other launches for this product.
Same idea, different domain
Nobody's really built a dev tools tool for Sales yet.