[Haskell-cafe] Haskell data types and Storable class

Henning Thielemann lemming at henning-thielemann.de
Wed Jun 18 10:33:25 EDT 2008

On Wed, 18 Jun 2008, Galchin, Vasili wrote:

> Hello,
>     I am reading the FFI spec. Something is unclear to me. Let's assume we
> have
>         data A = {b:B, .......}
>    and
>         data B ={ .............}
> both of which belong to class Storable. In the A instance of Storable I want
> to do a poke and peek of "b" into and out-of, respectively, B. How do I
> write the poke and peek function of "b" in the "instance Storable A"?

You will write a Storable instance for B and then just use the class 
methods 'poke' and 'peek' in the instance for A.

More information about the Haskell-Cafe mailing list