Re: Storable instance of () is broken

Sven Panne <[email protected]> Wed, 5 Jan 2022 11:13:37 +0100
Newsgroups gmane.comp.lang.haskell.libraries
Message-ID <CANBN=mskDjmEYSbkWtMSiB0SK_B=pDLSpZty+EswKE6b5xoBdQ@mail.gmail.com>
Am Mi., 5. Jan. 2022 um 09:01 Uhr schrieb Harendra Kumar <
[email protected]>:

> [...] 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.

_______________________________________________
Libraries mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries