{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreifdwn5cjmomiwohbll42xvu4rbyosjk5vhwxcim24pctriedwhfdi",
"uri": "at://did:plc:pi6woz4d47bkuws673w2il2r/app.bsky.feed.post/3mnghijst6oz2"
},
"path": "/t/h2jvm-a-haskell-library-for-writing-jvm-bytecode/14182#post_4",
"publishedAt": "2026-06-04T01:09:53.000Z",
"site": "https://discourse.haskell.org",
"tags": [
"DList",
"reverse-list"
],
"textContent": "evincar:\n\n> instead of storing a list in reverse order you can use a DList\n\nI’m always suspicious of `DList` in that physically it is essentially storing a list in reverse order, just less clearly: each closure is closing over one new element (actually, over another closure capturing that element) and over the closure recursively referencing the rest of the elements, which is the same structure as a cons cell (in either case, a data structure with two pointers, one pointing to the head and one to the tail), but less explicitly and with extra allocation/indirection (because each element is stored via an additional closure).\n\nSomething along the lines of reverse-list feels like a better approach—just a `newtype` wrapper around a regular list, to make clear that it’s in reverse order. I’ve never used that package, and I’ve always just been temped to make my own wrapper local to a project, allowing just two operations: `snoc` and `toList`.\n\nAnyway, side issue but just wanted to share my critique of `DList`.",
"title": "H2JVM - A Haskell Library for writing JVM Bytecode"
}