[Haskell-cafe] Solutions to Typeclassopedia Ex. 3.3.1?

Francesco Ariis fa-ml at ariis.it
Sun Sep 27 15:11:46 UTC 2015


On Sun, Sep 27, 2015 at 08:22:55PM +0530, Sumit Sahrawat, Maths & Computing, IIT (BHU) wrote:
> The holy source :)
> 
> https://hackage.haskell.org/package/base-4.8.1.0/docs/src/GHC.Base.html#line-614
> 
> https://hackage.haskell.org/package/base-4.8.1.0/docs/src/Data.Either.html#line-128
> 

instance Functor (Either a) where
    fmap _ (Left x) = Left x
    fmap f (Right y) = Right (f y)

`fmap id = id` and `fmap (f . g)  = fmap f . fmap g` seem to hold here, no?


More information about the Haskell-Cafe mailing list