So, the function type &quot;(Num a)=&gt;Integer-&gt;a&quot; means that return value of this function can be cast to any particular instance of class Num.<br><br>Ok. I have a my own class &quot;class A a&quot; and want to write function like this&nbsp; &quot;f:: (A a)=&gt;Integer-&gt;a&quot;. Can I do it?
<br><br><br><div><span class="gmail_quote">2008/1/21, Jon Fairbairn &lt;<a href="mailto:jon.fairbairn@cl.cam.ac.uk">jon.fairbairn@cl.cam.ac.uk</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&quot;Alexander Seliverstov&quot; &lt;<a href="mailto:seliverstov.a@gmail.com">seliverstov.a@gmail.com</a>&gt; writes:<br><br>&gt; How does caller choose which particular instance of Num they want?<br><br>They specify the type... or just pass the result to
<br>something that specifies the type. Try it in ghci:<br><br>Prelude&gt; let f:: Integral i =&gt; Integer -&gt; i; f = fromIntegral<br>Prelude&gt; let g :: Int -&gt; Int; g = id<br>Prelude&gt; :t g (f 5)<br>g (f 5) :: Int
<br>Prelude&gt; let h :: Integer -&gt; Integer; h = id<br>Prelude&gt; :t h (f 5)<br>h (f 5) :: Integer<br>Prelude&gt;<br><br>&gt; What the difference between haskell class and interface in object-oriented<br>&gt; languge such Java or C#?
<br><br>Really they are completely different animals that look a lot<br>alike because they serve similar purposes -- convergent<br>evolution!<br><br>--<br>J車n Fairbairn&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:Jon.Fairbairn@cl.cam.ac.uk">
Jon.Fairbairn@cl.cam.ac.uk</a><br><br><br>_______________________________________________<br>Haskell-Cafe mailing list<br><a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">
http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></blockquote></div><br><br clear="all"><br>-- <br>妊 批志忘忪快扶我快技,<br>妊快抖我志快把扼找抉志 均抖快抗扼忘扶忱把