M
M
mlyamasov2021-07-19 19:23:34
Haskell
mlyamasov, 2021-07-19 19:23:34

How to define an instance Storable in an elegant and portable way?

Let's say we have a type

data MyType = MyType Bool Double Char Int

instance Storable MyType where
    sizeOf = undefined
    alignment = undefined
    peek ptr = undefined
    poke ptr = undefined

This data will not be passed to the C function.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wiz, 2021-09-15
@mlyamasov

You can take derive-storable and output via Generic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question