{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreia5kzvl4c2wmxhibodoo3kt33iaizpwt3wgx4dftvuxgb6qat4gzm",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mpkftckh2aa2"
},
"path": "/t/low-level-haskell-the-cursed-way-to-emulate-inline-assembly-in-haskell-ghc/14333#post_7",
"publishedAt": "2026-07-01T01:49:54.000Z",
"site": "https://discourse.haskell.org",
"tags": [
"hs-bindgen",
"this example",
"generated code"
],
"textContent": "Regarding passing `struct`s 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.\n\nIn 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.",
"title": "Low-level Haskell: The cursed way to emulate inline assembly in Haskell/GHC,"
}