Thanks!<span></span><br><br>On Monday, August 18, 2014, Bob Ippolito <<a href="mailto:bob@redivi.com">bob@redivi.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">The definition of a Functor requires that exactly one of the type variables be free, which is why it's written as `Either a` instead of `Either a b`. Any fields that are not `b` must be simply passed through as-is by fmap. There could be a separate functor that would fmap over the Left, but there isn't (in the base package anyhow).<div>

<br></div><div>There's a related Functor for `(,) a` where the Functor fmaps over the snd of the tuple, and the fst is left as-is.</div><div><br></div><div>fmap (+1) ('a', 2) == ('a', 3)</div><div>fmap (+1) (Right 2) == Right 3</div>

<div>fmap (+1) (Left 'a') == Left 'a'</div><div><br></div><div>Chris Done recently prototyped a fmap explorer that you might find useful:</div><div><a href="http://www.reddit.com/r/haskell/comments/2dok9w/functor_explorer/" target="_blank">http://www.reddit.com/r/haskell/comments/2dok9w/functor_explorer/</a><br>

</div><div><br></div><div>-bob</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 18, 2014 at 11:02 AM, Frank <span dir="ltr"><<a href="javascript:_e(%7B%7D,'cvml','frankdmartinez@gmail.com');" target="_blank">frankdmartinez@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<div>    I'm reading "Learn You a Haskell..." and have a question about the chapter "Making Our Own Types and Typeclasses". On the 'Functor'/'Either' example, I feel completely lost. I don't see why the 'Left x' portion of 'Functor (Either a)' is simply 'Left x' and the document is not exactly clear. Any clarification would be most appreciated.</div>


<div><br></div><div>Sincerely,</div><div>Frank D. Martinez</div><span><font color="#888888"><br><br>-- <br></font></span>P.S.: I prefer to be reached on BitMessage at BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6<br>

<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="javascript:_e(%7B%7D,'cvml','Beginners@haskell.org');" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>
</blockquote><br><br>-- <br>P.S.: I prefer to be reached on BitMessage at BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6<br>