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.

On Tue, Oct 8, 2019, 11:49 AM Henning Thielemann <lemming@henning-thielemann.de> wrote:

On Tue, 8 Oct 2019, David Feuer wrote:

> newtype WrappedEnum a = WrappedEnum a
> instance Enum a => Storable (WrappedEnum a) where
>   ...

That's almost what I recently defined in a custom package:
    https://hub.darcs.net/thielema/storable-enum/browse/src/Data/Enum/Storable.hs

But I also let the user choose the underlying machine type.