Storable instance of () is broken
Sven Panne
svenpanne at gmail.com
Wed Jan 5 10:13:37 UTC 2022
Am Mi., 5. Jan. 2022 um 09:01 Uhr schrieb Harendra Kumar <
harendra.kumar at gmail.com>:
> [...] The size of () is defined as 0. It sounds absurd for a Storable to
> have a size of 0?
This is not absurd at all, there is absolutely no information to be stored.
Everything one needs to know is in the type here.
> This means that we can read an infinite number of ()
> type values out of nothing (no memory location required) or store an
> infinite number of () type values without even requiring a memory
> location to write to.
>
Exactly.
> [...] Can this be fixed? Is there a compelling argument to keep it like
> this? [...]
There is nothing to be fixed on the Storable side of things, the fix needs
to be in your code, as David has already mentioned. And in addition: I
would *strongly* advise to leave the Storable () instance as-is, I'm quite
sure that otherwise tons of code will break in mysterious ways, undetected
by any compiler.
Cheers,
S.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20220105/c9a0db4d/attachment.html>
More information about the Libraries
mailing list