<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 12, 2014 at 11:44 AM, Venu Chakravorty <span dir="ltr"><<a href="mailto:c.venu@aol.com" target="_blank">c.venu@aol.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Prelude> :t (+)</div>

<div>(+) :: (Num a) => a -> a -> a</div>

<div><br>
</div>

<div><span style="white-space:pre-wrap">  </span>What I understand from the above is that "+" is a function that takes two args</div>

<div>which are types of anything that IS-AN instance of "Num" (Int, Integer, Float, Double)</div>

<div>and returns an instance of "Num".</div>

<div></div></blockquote></div><br>Not exactly. It says that, given some type a that is an instance of Num, it will add two values of that type and produce a new value of that same type. You cannot mix and match types; it always works on some specific type, although those types may change between uses of (+).</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">This is somewhat hidden by the way numeric literals are handled: a literal without a decimal point is handled as if you had wrapped it in fromIntegral, and one with a decimal point is handled as if you had wrapped it in fromRational.<br>
<div><br></div>-- <br><div dir="ltr"><div>brandon s allbery kf8nh                               sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div>
<div>unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div>
</div></div>