<br><br><div class="gmail_quote">2008/1/21 Alexander Seliverstov <<a href="mailto:seliverstov.a@gmail.com">seliverstov.a@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
So, the function type "(Num a)=>Integer->a" 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 "class A a" and want to write function like this "f:: (A a)=>Integer->a". Can I do it?
<br><br></blockquote><br>Only if you make the function f a member of class A. Then it is the responsibility of each particular type which is an instance of A to define a way of converting an Integer into a value of that type. For example:<br>
<br>class A a where<br> f :: Integer -> a<br> ... other functions...<br><br>instance A Integer where<br> f = id<br><br>instance A String where<br> f = show<br><br>and so on.<br><br>-Brent<br></div>