harmont-dev

harmont-dev / hsrs

Public

Type-safe Haskell Rust Bindings

10
0
100% credibility
Found May 19, 2026 at 43 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
Rust
AI Summary

hsrs is a developer tool that makes it easy to call Rust code from Haskell (and vice versa). You annotate your Rust types and functions with simple markers, run a code generator, and get automatically-generated Haskell bindings that handle memory management, type conversions, and data serialization for you. It supports common types like numbers, strings, lists, and custom structs, converting them appropriately between languages.

How It Works

1
💡 You discover you need Rust and Haskell to work together

Maybe you found a great Rust library but your main project is in Haskell, or you need Haskell's features in your Rust application.

2
📦 You find hsrs and learn it bridges the two languages

The tool promises to automatically connect your Rust code to Haskell, handling all the tricky parts like memory and data conversion.

3
✏️ You add simple markers to your Rust code

You sprinkle a few special annotations on your Rust types and functions—like little sticky notes that tell the system what to share.

4
🎩 You run the code generator

A single command reads your annotated Rust code and magically produces matching Haskell code that understands your types.

5
Your Haskell code is ready—how do you use it?
🧩
Import it directly into your Haskell project

Just import the generated module and call your Rust functions like any normal Haskell functions.

📚
Let the library handle the details

Memory management, type conversions, and error handling happen automatically behind the scenes.

6
🚀 Everything just works

Your Rust functions appear as natural Haskell code. Strings, lists, and even complex types flow smoothly between languages.

🎉 Your project is complete

You successfully combined the best of both worlds—Rust's performance and Haskell's expressiveness—without wrestling with the technical details.

Sign up to see the full architecture

5 more

Sign Up Free

Star Growth

See how this repo grew from 43 to 10 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is hsrs?

hsrs generates type-safe Haskell bindings from annotated Rust code. You mark Rust types and functions with simple attributes, run a CLI tool, and get idiomatic Haskell wrappers that handle FFI boilerplate, memory management, and serialization automatically. Complex types like structs, strings, and vectors cross the boundary via Borsh serialization, while primitives pass directly through C FFI. The generated Haskell code wraps raw pointers in ForeignPtr with automatic cleanup.

Why is it gaining traction?

Writing FFI bindings by hand is tedious and error-prone. hsrs eliminates this friction entirely—you write Rust normally, add a few attributes, and Haskell bindings appear. The annotation system is minimal and intuitive. The generated code is idiomatic Haskell with proper type mappings: Result becomes Either, Option becomes Maybe, Vec becomes List, and String becomes Text. The tool handles the tedious parts so developers can focus on their actual logic.

Who should use this?

Rust library authors exposing APIs to Haskell callers will benefit most. Haskell developers who need Rust performance for hot paths but want to stay in Haskell for the rest of their code. Teams with existing Rust infrastructure looking to add Haskell frontends without manual binding maintenance. If you are currently writing FFI glue code by hand, this saves time immediately.

Verdict

hsrs solves a real pain point with a clean annotation-driven workflow. The approach is sound, but the 1.0% credibility score and 10 stars reflect an early-stage project with limited community validation. Evaluate it for non-critical paths first, but watch it closely—type-safe FFI generation is a genuinely useful idea that deserves more attention.

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.