[GHC] #13498: More storable instances?
GHC
ghc-devs at haskell.org
Thu Mar 30 06:42:23 UTC 2017
#13498: More storable instances?
-------------------------------------+-------------------------------------
Reporter: wyager | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 8.0.1
Resolution: | Keywords: Storable,
| Foreign, Ptr
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by svenpanne):
The reasoning why sum types have no `Storable` instance by default is that
the encoding would be quite arbitrary. In your example: Why are the tags 8
bit wide, and why are the tag values `0` and `1`? Do we need a tag at all?
For e.g. `Maybe (Ptr a)` a more common encoding is to have no tag at all
and represent `Nothing` as a null pointer. For product types things are
less arbitrary, but even then there is the issue of alignment. If you need
serialization, you can use `Data.Binary`.
I think we should close this ticket as `wontfix`, because the lack of
these instances was a very deliberate decision.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13498#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list