Low-level Haskell: The cursed way to emulate inline assembly in Haskell/GHC,
Haskell Community [Unofficial]
July 1, 2026
Regarding passing structs by value, hs-bindgen implements this by generating the wrapper function within the generated Haskell module, along with a Haskell translation that handles the memory allocation.
In this example, function thing_fun_1 is passed a struct argument by value and function thing_fun_2 returns a struct result by value. The generated code includes all the necessary C and Haskell code, only exporting the public API.
Discussion in the ATmosphere