<div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 16, 2012 at 8:00 AM, Daryoush Mehrtash <span dir="ltr">&lt;<a href="mailto:dmehrtash@gmail.com" target="_blank">dmehrtash@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Sorry wrong paste<div><br></div><div><div>Prelude&gt; :t 3 2</div><div>3 2 :: (Num a, Num (a -&gt; t)) =&gt; t</div></div></blockquote><div><br>It means that 2 has type a (which must be in the Num class), 3 has type (a -&gt; t) (which also must be in the Num class), and the type of (3 2) is therefore t.<br>

When you apply one expression to another, the first must have function type, and the second must have the type of the domain of the function, hence the a -&gt; t and a.<br>Furthermore, the numeric literals are always interpreted as being in the Num class.<br>

I haven&#39;t been able to find any good introduction to numeric literals and the Num class with quick search, so if anyone else on list can point us to one (if it exists) that would be great.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div class="im"><div><br></div><div><br></div><div>What does the type mean in plain english?</div><div><br></div><div>Daryoush</div>
<br></div><div><div class="h5"><div class="gmail_quote">On Fri, Nov 16, 2012 at 12:00 AM, Daryoush Mehrtash <span dir="ltr">&lt;<a href="mailto:dmehrtash@gmail.com" target="_blank">dmehrtash@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Yes, same problem, and again I have no idea how to read the type<div><br></div><div><div><div>Prelude&gt; :t max. 3 2</div><div>max. 3 2 :: (Ord b, Num a1, Num (a1 -&gt; a -&gt; b)) =&gt; a -&gt; b -&gt; b</div>
<div><br></div><div>
<br></div></div><div>What does the type mean in plain english?</div><span><font color="#888888"><div><br></div><div>Daryoush</div></font></span><div><div><br><div class="gmail_quote">On Thu, Nov 15, 2012 at 11:56 PM, Ramana Kumar <span dir="ltr">&lt;<a href="mailto:Ramana.Kumar@cl.cam.ac.uk" target="_blank">Ramana.Kumar@cl.cam.ac.uk</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Another experiment may be revealing:<br><br>:t 3 2<div><div><br><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Fri, Nov 16, 2012 at 7:46 AM, Daryoush Mehrtash <span dir="ltr">&lt;<a href="mailto:dmehrtash@gmail.com" target="_blank">dmehrtash@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I see the point with :t (.)  that <div><br></div><div>max.(+1) 2 2</div><div><br></div><div>is the same as </div><div>




<br>
</div><div>max. 3 2</div><div><br></div><div>Which is not what I want.</div><div><br></div><div>But I have no idea what the type signature of this expression mean now</div>
<div><br></div><div><div>Prelude&gt; :t max. 3 2</div><div>max. 3 2 :: (Ord b, Num a1, Num (a1 -&gt; a -&gt; b)) =&gt; a -&gt; b -&gt; b</div><div><br></div><div>Any idea?</div><span><font color="#888888"><div>

<br></div><div>Daryoush</div></font></span><div><div><div><br></div>
<br><div class="gmail_quote">On Thu, Nov 15, 2012 at 11:19 PM, Ramana Kumar <span dir="ltr">&lt;<a href="mailto:Ramana.Kumar@cl.cam.ac.uk" target="_blank">Ramana.Kumar@cl.cam.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






Hi Daryoush,<br><br>I recommend you try these experiments first, and then reply back if you&#39;re still confused.<br><br>:t max<br><br>:t (+1)<br><br>:t max . (+1)<br><br>:t (+1) 2<br><br>:t (.)<br><div class="gmail_extra">








<br><br><div class="gmail_quote"><div><div>On Fri, Nov 16, 2012 at 7:10 AM, Daryoush Mehrtash <span dir="ltr">&lt;<a href="mailto:dmehrtash@gmail.com" target="_blank">dmehrtash@gmail.com</a>&gt;</span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>

<div>I am having hard time understanding how removing the  outer parenthesis in</div><div><br></div><div>(max.(+1)) 2 2 </div><div><br></div><div>to </div><div><br></div><div>max.(+1) 2 2 </div><div><br></div><div>changes the meaning of expression.</div>









<div><br></div><div>My expectation was that &quot;max.(+1) takes two numbers and returns the max as defined in the type:</div><div><br></div><div><div>:t max.(+1)</div><div>max.(+1) :: (Ord b, Num b) =&gt; b -&gt; b -&gt; b</div>









</div><div><br></div><div><br></div><div><br></div><div>With parenthesis it does what I expect it to:</div><div><br></div><div><br></div><div>Prelude&gt; :t (max.(+1)) 2 2</div><div>(max.(+1)) 2 2 :: (Ord b, Num b) =&gt; b</div>









<div>Prelude&gt;  (max.(+1)) 2 2</div><div>3</div><div><br></div><div><br></div><div>But if I remove the parenthesis I get a beast that I have no idea what its type signature mean any more</div><div><br></div><div>Prelude&gt; :t (max.(+1)) 2 2</div>









<div>(max.(+1)) 2 2 :: (Ord b, Num b) =&gt; b</div><div>Prelude&gt; :t max.(+1) 2 2</div><div>max.(+1) 2 2 :: (Ord b, Num a1, Num (a1 -&gt; a -&gt; b)) =&gt; a -&gt; b -&gt; b</div><div><br></div><div><br></div><div>How did removal of parenthesis changed the meaning?      How do you interpret the type:  &quot;(Ord b, Num a1, Num (a1 -&gt; a -&gt; b)) =&gt; a -&gt; b -&gt; b&quot;?</div>









<div><br></div><div>Thanks</div><span><font color="#888888"><div><br></div><div><br></div><div><br></div>-- <br>Daryoush<br><br>Weblog:  <a href="http://onfp.blogspot.com/" target="_blank">http://onfp.blogspot.com/</a><br>









</font></span><br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Daryoush<br><br>Weblog:  <a href="http://onfp.blogspot.com/" target="_blank">http://onfp.blogspot.com/</a><br>
</div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Daryoush<br><br>Weblog:  <a href="http://onfp.blogspot.com/" target="_blank">http://onfp.blogspot.com/</a><br>
</div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Daryoush<br><br>Weblog:  <a href="http://onfp.blogspot.com/" target="_blank">http://onfp.blogspot.com/</a><br>
</div></div></div>
</blockquote></div><br></div>