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)`.On Tue, Apr 14, 2015 at 9:47 AM, Shishir Srivastava <shishir.srivastava@gmail.com> wrote:_______________________________________________Hi,Can someone please explain the difference in outputs of the following two expressions ---------------ghci> fmap (replicate 3) (Right "blah")Right ["blah","blah","blah"]ghci> fmap (replicate 3) (Left "foo")Left "foo"---------------Why does 'Right' return a list of Strings whereas 'Left' returns just a String.Thanks,Shishir
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners