<div dir="ltr">The Functor instance is defined for `Either a`, so Left is fixed. fmap only maps over Right. You'll find the same behavior for `(,) a`, e.g. `fmap (*2) (1,2) == (1,4)`.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 14, 2015 at 9:47 AM, Shishir Srivastava <span dir="ltr"><<a href="mailto:shishir.srivastava@gmail.com" target="_blank">shishir.srivastava@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi, </div><div><br></div><div>Can someone please explain the difference in outputs of the following two expressions - </div><div><br></div><div>--------------</div><div><br></div><div><div><font face="monospace, monospace">ghci> fmap (replicate 3) (Right "blah")  </font></div><div><font face="monospace, monospace">Right ["blah","blah","blah"]  </font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">ghci> fmap (replicate 3) (Left "foo")  </font></div><div><font face="monospace, monospace">Left "foo" </font></div></div><div><font face="monospace, monospace"><br></font></div><div>---------------</div><div><br></div><div>Why does 'Right' return a list of Strings whereas 'Left' returns just a String.</div><div><br></div><div>Thanks,</div><div><div><div dir="ltr"><font color="#0b5394"><font style="background-color:rgb(255,255,255)"><font size="2" face="georgia, serif">Shishir </font></font></font><br></div></div></div>
</div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>