Re: Storable instance of () is broken
Roman Cheplyaka <[email protected]> Wed, 5 Jan 2022 13:05:02 +0200
| Newsgroups | gmane.comp.lang.haskell.libraries |
|---|---|
| Message-ID | <[email protected]> |
On 05/01/2022 12.39, Georgi Lyubenov wrote: > I have an additional question: > > It is true that in a strict/unboxed language, the type of () is > sufficient to reproduce its value. 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? If you look at it from the strict-by-default point of view, it does appear inconsistent with the other instances. However, if you look at it from the non-strict-by-default point of view, which is arguably more native to Haskell, then all instances follow the same principle: they are maximally non-strict. It's just when you store anything non-trivial, you are forced to be strict in order to fulfill the task, but you never add any gratuitous strictness. Roman _______________________________________________ Libraries mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries