class Functor f where map :: (a -> b) -> f a -> f b data Either a b = Left a | Right b instance Functor (Either a) where map _ (Left x) = Left x map f (Right y) = Right (f y) id :: Integer -> Integer id x = x main = map id (Left (12 :: Integer)) -- (Left 12)