I am still reading the web pages. Here is what I tried:<br><br>data SigNotify = Signal | None | Thread | ThreadId<br><br><br>instance Storable SigNotify where<br><br> sizeOf _ = (#const sizeof (int))<br><br> alignment _ = 1<br>
<br> poke Signal = (#const SIGEV_SIGNAL)<br><br> poke None = poke (#const SIGEV_NONE)<br><br> poke Thread = poke (#const SIGEV_THREAD)<br><br> poke ThreadId = poke (#const SIGEV_THREAD_ID)<br><br><br>but I got ...<br>
<br> Couldn't match expected type `Ptr SigNotify'<br> against inferred type `SigNotify'<br> In the pattern: Signal<br> In the definition of `poke': poke Signal = poke (0)<br> In the definition for method `poke'<br>
<br>Basically I want to marshall SigInfo constructors to CInt values. ??<br><br>Regards, Vasili<br><br><br><div class="gmail_quote">On Fri, Jun 20, 2008 at 3:20 PM, Bulat Ziganshin <<a href="mailto:bulat.ziganshin@gmail.com">bulat.ziganshin@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello Vasili,<br>
<div class="Ih2E3d"><br>
Friday, June 20, 2008, 11:51:11 PM, you wrote:<br>
> data Bonzo = A | B |C<br>
<br>
</div><div class="Ih2E3d">> How do I write the poke functions and call them?<br>
<br>
</div>instance Storable Bonzo<br>
poke A = poke 0<br>
poke B = poke 1<br>
poke C = poke 4<br>
<br>
call as "poke x"<br>
<br>
probably, you don't understand differences between OOP classes and<br>
type classes. look at <a href="http://haskell.org/haskellwiki/OOP_vs_type_classes" target="_blank">http://haskell.org/haskellwiki/OOP_vs_type_classes</a><br>
and papers mentioned there<br>
<font color="#888888"><br>
<br>
--<br>
Best regards,<br>
Bulat mailto:<a href="mailto:Bulat.Ziganshin@gmail.com">Bulat.Ziganshin@gmail.com</a><br>
<br>
</font></blockquote></div><br>