Document conditions on deriving Functor
GHC can derive Functor for Okay, but rejects the equivalent Bad.
{-# LANGUAGE DeriveFunctor #-}
data Okay f g a b = Inl (f a b) | Inr (g a b) deriving (Functor)
newtype Bad f g a b = Bad (Either (f a b) (g a b)) deriving (Functor)
Can't make a derived instance of ‘Functor (Bad f g a)’:
Constructor ‘Bad’ must use the type variable only as the last argument of a data type
In the data declaration for ‘Bad’