Storable instance of () is broken

Sven Panne svenpanne at gmail.com
Wed Jan 5 10:51:14 UTC 2022


Am Mi., 5. Jan. 2022 um 11:40 Uhr schrieb Georgi Lyubenov <
godzbanebane at gmail.com>:

> [...] However, here, trying to store undefined :: () is no different from
> trying to store () :: (). Is this difference in behaviour with other
> instances of Storable (where presumably trying to store undefined will blow
> up, as there is indeed some work to do there) intentionally ignored?
>

Good point, this might be seen as a bug/inconsistency of Storable (): peek
and poke are not strict in their arguments, while probably all(?) other
instances are. But
https://www.haskell.org/onlinereport/haskell2010/haskellch37.html doesn't
require this, so I would be reluctant to really call this a bug. Changing
this can have "interesting" effects on the ecosystem, too, who knows?
Again, this would be a change where the compiler doesn't help you.

Cheers,
   S.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20220105/b0a9ce09/attachment.html>


More information about the Libraries mailing list