<div dir="auto">Yes, yours is better, but I'd go with Enum on both ends rather than relying on rewrite rules to make sure fromIntegral isn't slow.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Oct 8, 2019, 11:49 AM Henning Thielemann <<a href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On Tue, 8 Oct 2019, David Feuer wrote:<br>
<br>
> newtype WrappedEnum a = WrappedEnum a<br>
> instance Enum a => Storable (WrappedEnum a) where<br>
>   ...<br>
<br>
That's almost what I recently defined in a custom package:<br>
    <a href="https://hub.darcs.net/thielema/storable-enum/browse/src/Data/Enum/Storable.hs" rel="noreferrer noreferrer" target="_blank">https://hub.darcs.net/thielema/storable-enum/browse/src/Data/Enum/Storable.hs</a><br>
<br>
But I also let the user choose the underlying machine type.</blockquote></div>