External Publication
Visit Post

[ANN] hsrs -- Ergonomic Haskell Bindings for Rust

Haskell Community [Unofficial] May 19, 2026
Source
Always cool to see improved ffi! My initial question is why use a newtype around a Word8 and pattern synonyms instead of actual enumerated types? You can still go via an integral interpretation in the boundary, and you’d be able to derive Enum and Bounded, as well as letting the Haskell side write safer code. For example: data Register = Reg0 | Reg1 | Count deriving (Generic, Show, Eq, Enum, Bounded) deriving (BorshSize, ToBorsh, FromBorsh) via (ActuallyAsEnum Register) instance (Enum a) => ToBorsch (ActuallyAsEnum a) where {- define using toEnum and fromEnum -} Or indeed using AsEnum from Borsh itself.

Discussion in the ATmosphere

Loading comments...