<div dir="ltr">Hi, <div><br></div><div>Please can someone explain why these two expression behave differently - </div><div><br></div><div><font face="monospace, monospace">----</font></div><div><font face="monospace, monospace">fmap (\x -> x) Just 2<br></font></div><div><font face="monospace, monospace">Just 2</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">-----</font></div><div><font face="monospace, monospace">fmap (\x -> x+2) Just 2</font><br></div><div><br></div><div><div><i>No instance for (Num (Maybe a0)) arising from a use of `it'</i></div><div><i>In a stmt of an interactive GHCi command: print it</i></div></div><div><i><br></i></div><div>----</div><div>The first expression evaluates fine whereas the second one fails. However if I do - </div><div>----</div><div><br></div><div><span style="font-family:monospace,monospace">fmap (\x -> x+2) $ Just 2</span><br></div><div><span style="font-family:monospace,monospace">Just 4</span></div><div><span style="font-family:monospace,monospace">----</span></div><div><span style="font-family:monospace,monospace"><br></span></div><div><font face="arial, helvetica, sans-serif">Then the second expression also returns the Maybe value. Why is $ needed in second expression but not in the first one ?</font></div><div><span style="font-family:monospace,monospace"><br></span></div><div><span style="font-family:monospace,monospace">Thanks,</span></div><div><div><div class="gmail_signature"><div dir="ltr"><font color="#0b5394"><font style="background-color:rgb(255,255,255)"><font size="2" face="georgia, serif">Shishir </font></font><br></font><br></div></div></div>
</div></div>