<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Looks like the fmap definition for the Either functor matches what's given in Learn You A Haskell ...<br><br>instance Functor (Either a) where&nbsp; <br>&nbsp;&nbsp; fmap f (Right x) = Right (f x)&nbsp; <br>&nbsp;&nbsp; fmap f (Left x) = Left x<br><br>but Hoogle couldn't find Control.Monad.Instances<br><br>How else can I look at the code?<br><br>Michael<br><br>[michael@localhost ~]$ ghci<br>GHCi, version 6.12.1: http://www.haskell.org/ghc/&nbsp; :? for help<br>Loading package ghc-prim ... linking ... done.<br>Loading package integer-gmp ... linking ... done.<br>Loading package base ... linking ... done.<br>Loading package ffi-1.0 ... linking ... done.<br>Prelude&gt; :m + Control.Monad.Instances<br>Prelude Control.Monad.Instances&gt; :m + Data.Either<br>Prelude Control.Monad.Instances Data.Either&gt; let l = Left 5<br>Prelude Control.Monad.Instances
 Data.Either&gt; fmap (*2) l<br>Left 5<br>Prelude Control.Monad.Instances Data.Either&gt; let r = Right "five"<br>Prelude Control.Monad.Instances Data.Either&gt; fmap length r<br>Right 4<br><br><br>--- On <b>Sat, 8/28/10, Brandon S Allbery KF8NH <i>&lt;allbery@ece.cmu.edu&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Brandon S Allbery KF8NH &lt;allbery@ece.cmu.edu&gt;<br>Subject: Re: [Haskell-cafe] On to applicative<br>To: haskell-cafe@haskell.org<br>Date: Saturday, August 28, 2010, 9:06 PM<br><br><div class="plainMail">-----BEGIN PGP SIGNED MESSAGE-----<br>Hash: SHA1<br><br>On 8/28/10 20:43 , michael rice wrote:<br>&gt; I'm looking at a discussion of Either (as functor) here:<br>&gt; <br>&gt; <a href="http://learnyouahaskell.com/making-our-own-types-and-typeclasses#the-functor-typeclass"
 target="_blank">http://learnyouahaskell.com/making-our-own-types-and-typeclasses#the-functor-typeclass</a><br>&gt; <br>&gt; instance Functor (Either a) where&nbsp; <br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;fmap f (Right x) = Right (f x)&nbsp; <br>&gt;&nbsp; &nbsp;&nbsp;&nbsp;fmap f (Left x) = Left x<br>&gt; <br>&gt; And this line in Data.Either<br>&gt; <br>&gt; Functor (Either a)<br>&gt; <br>&gt; but no fmap defined here.<br>&gt; <br>&gt; How come?<br><br>Historical accident, to wit:&nbsp; Haskell 98 minimally defined Either in the<br>Prelude, so in practice we get the basic definitions (Either itself and its<br>Functor and Monad instances) from the Prelude and other utility functions<br>from Data.Either.<br><br>- -- <br>brandon s. allbery&nbsp; &nbsp;&nbsp;&nbsp;[linux,solaris,freebsd,perl]&nbsp; &nbsp; &nbsp; <a ymailto="mailto:allbery@kf8nh.com" href="/mc/compose?to=allbery@kf8nh.com">allbery@kf8nh.com</a><br>system administrator&nbsp; [openafs,heimdal,too
 many hats]&nbsp; <a ymailto="mailto:allbery@ece.cmu.edu" href="/mc/compose?to=allbery@ece.cmu.edu">allbery@ece.cmu.edu</a><br>electrical and computer engineering, carnegie mellon university&nbsp; &nbsp; &nbsp; KF8NH<br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v2.0.10 (Darwin)<br>Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org/" target="_blank">http://enigmail.mozdev.org/</a><br><br>iEYEARECAAYFAkx5sq4ACgkQIn7hlCsL25WA+QCeKUOuNN4kUpci9fH6BcFZ5WqG<br>bX8AoIBImpWLoxVz7kcwVIuHycYR/v5G<br>=EaIs<br>-----END PGP SIGNATURE-----<br>_______________________________________________<br>Haskell-Cafe mailing list<br><a ymailto="mailto:Haskell-Cafe@haskell.org" href="/mc/compose?to=Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></div></blockquote></td></tr></table><br>