Storable instance of () is broken

Sven Panne svenpanne at gmail.com
Wed Jan 5 12:12:32 UTC 2022


Am Mi., 5. Jan. 2022 um 12:42 Uhr schrieb David Feuer <david.feuer at gmail.com
>:

> No. Consider a type like this:
>
> data Foo a = Foo !Int !a
>
> instance Storable a => Storable (Foo a) where ...
>
> Now if a happens to be (), we pay only one word per Foo. [...]
>

This is exactly the kind of breakage I had in mind: With the proposed
change, the storage layout would change, and the compiler wouldn't warn you
about that at all. Note that I'm not arguing about memory efficiency, it's
all about a subtle semantic change for the sake of a single library,
wanting to change something which was in place for 10-20 years. Seems like
an extremely bad move from the POV of the Haskell ecosystem: It's exactly
this kind of ad hoc changes which annoys people.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20220105/f9685fc9/attachment.html>


More information about the Libraries mailing list