<div dir="ltr"><div><div><div><div><div>You can alias HklFactory:<br></div>type HklFactory = Ptr ()<br><br></div>Or if you want to avoid mixing HklFactory and other pointers, you can use:<br></div>newtype HklFactory = HklFactory (Ptr ()) deriving (Storable)<br><br></div>The latter requires the GeneralizedNewtypeDeriving extension, see: <a href="https://wiki.haskell.org/Foreign_Function_Interface#Renaming_and_Storable_instances">https://wiki.haskell.org/Foreign_Function_Interface#Renaming_and_Storable_instances</a><br><br></div>Sylvain<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-11-08 21:30 GMT+01:00 PICCA Frederic-Emmanuel <span dir="ltr"><<a href="mailto:frederic-emmanuel.picca@synchrotron-soleil.fr" target="_blank">frederic-emmanuel.picca@synchrotron-soleil.fr</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok, so now I get this error<br>
<br>
<br>
ghkl.hs:20:18:<br>
    No instance for (Foreign.Storable.Storable HklFactory)<br>
      arising from a use of ‘peekArray’<br>
    In a stmt of a 'do' block: peekArray n factories<br>
    In the expression:<br>
      do { factories <- c_hkl_factory_get_all ptr;<br>
           n <- peek ptr;<br>
           peekArray n factories }<br>
    In the second argument of ‘($)’, namely<br>
      ‘\ ptr<br>
         -> do { factories <- c_hkl_factory_get_all ptr;<br>
                 n <- peek ptr;<br>
                 .... }’<br>
<br>
<br>
What should I do to create a Storable for HklFactory which is a simple pointer.<br>
<br>
Thanks<br>
<div class="HOEnZb"><div class="h5"><br>
Frederic<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>