<div dir="ltr"><br><div><pre style="white-space:pre-wrap;color:rgb(0,0,0)">On Sun, Jul 13, 2025 at 11:47:36AM +0100, Tom Ellis wrote:</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><pre style="white-space:pre-wrap">><i>
</i>><i> There is, however, a known trick. This works:
</i>><i>
</i></pre><br class="gmail-Apple-interchange-newline">
Ah yes. Same solution here</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><a href="https://discourse.haskell.org/t/how-to-use-requiredtypearguments-with-typeclasse-methods/12187/3">https://discourse.haskell.org/t/how-to-use-requiredtypearguments-with-typeclasse-methods/12187/3</a><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Currently, `RequiredTypeArguments` is documented as " <span style="background-color:rgb(252,252,252);color:rgb(64,64,64);font-family:Lato,proxima-nova,"Helvetica Neue",Arial,sans-serif;font-size:16px;font-weight:700">only partially implemented in GHC</span>". Full specification to be found in proposal #281.</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">That proposal doesn't give examples of how to write instances for `sizeOf`, as and when we get Dependent Haskell in full. Will it still need the type equality trick?</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><pre style="white-space:pre-wrap">></pre><pre style="white-space:pre-wrap">><i> (But I prefer your [Viktor's] solution: the wrapper.)</i></pre><pre style="white-space:pre-wrap"><i>></i></pre><pre style="white-space:pre-wrap"><i><br></i></pre>Yes. That in effect still uses a term-level proxy for the type, as argument to _sizeOf. For example I could go</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"> pattern Bool :: Bool</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"> pattern Bool = undefined</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"> ... _sizeOf Bool ...</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"><br></pre></div></div>