On Sun, Jul 13, 2025 at 11:47:36AM +0100, Tom Ellis wrote:
>
> There is, however, a known trick. This works:
>
Ah yes. Same solution here
https://discourse.haskell.org/t/how-to-use-requiredtypearguments-with-typeclasse-methods/12187/3
Currently, `RequiredTypeArguments` is documented as " only partially implemented in GHC". Full specification to be found in proposal #281.
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?
>
> (But I prefer your [Viktor's] solution: the wrapper.)
>
Yes. That in effect still uses a term-level proxy for the type, as argument to _sizeOf. For example I could go
pattern Bool :: Bool
pattern Bool = undefined
... _sizeOf Bool ...