{-# OPTIONS_GHC -fglasgow-exts #-} module FunctorN where import Control.Monad.Instances (Functor(..)) class Functor2 f where f2map :: (a -> b) -> f a c -> f b c instance Functor2 (,) where f2map f (x,y) = (f x,y) instance Functor2 Either where f2map f (Left x) = Left (f x) f2map f (Right y) = Right y class Functor3 f where t3map :: (a -> b) -> f a c d -> f b c d instance Functor3 (,,) where t3map f (x,y,z) = (f x,y,z) class Functor4 f where q4map :: (a -> b) -> f a c d e -> f b c d e instance Functor4 (,,,) where q4map f (w,x,y,z) = (f w,x,y,z)