Fast impertive pointers (static, unboxing, etc.) with Struct library : <p>I am interested in using more efficient pointers for a project implementing an imperative language in Haskell. There is already a <a href="https://github.com/ekmett/structs" rel="noreferrer">library for that: Struct</a>. There is a <a href="https://www.schoolofhaskell.com/user/edwardk/unlifted-structures" rel="noreferrer">blog post</a> on it and <a href="http://ekmett.github.io/structs/Data-Struct.html" rel="noreferrer">brief documentation</a>.</p>

<p>The problem is there is only a quite sophisticated example of <a href="https://github.com/ekmett/structs/blob/master/src/Data/Struct/Internal/LinkCut.hs" rel="noreferrer">linkcut trees</a>. For someone like me who doesn't use Haskell on a daily basis, it is quite exhausting to battle little documented code, template haskell, etc.</p>

<p>I would need a simpler example to get started, along the lines of expressing either of those two data types:</p>

<pre><code>import Data.IORef

data DLL a = DLL a (Maybe (IORef (DLL a))) (Maybe (IORef (DLL a)))

data DLLINT = DLLINT Int (Maybe (IORef DLLINT)) (Maybe (IORef DLLINT))
</code></pre>

<p>This should be just a few simple lines for someone who is fluent in Haskell/GHC.</p>

<p>How do I express one of the data types above with the Struct library?</p>
