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).

There's a related Functor for `(,) a` where the Functor fmaps over the snd of the tuple, and the fst is left as-is.

fmap (+1) ('a', 2) == ('a', 3)
fmap (+1) (Right 2) == Right 3
fmap (+1) (Left 'a') == Left 'a'

Chris Done recently prototyped a fmap explorer that you might find useful:
http://www.reddit.com/r/haskell/comments/2dok9w/functor_explorer/

-bob



On Mon, Aug 18, 2014 at 11:02 AM, Frank <frankdmartinez@gmail.com> wrote:
Hi,
    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.

Sincerely,
Frank D. Martinez


--
P.S.: I prefer to be reached on BitMessage at BM-2D8txNiU7b84d2tgqvJQdgBog6A69oDAx6

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners