Is there a way to compile this code?
If not, why?


{-# LANGUAGE RankNTypes, ConstraintKinds #-}

-- This compiles
bar :: (Num a, Num b) => (forall c. Num c => c -> c) -> Either a b -> Either a b
bar f (Left a) = Left (f a)
bar f (Right b) = Right (f b)

bar' = bar (+ 2)


-- This doesn't compile because foo' does not typecheck
foo :: (tc a, tc b) => (forall c. tc c => c -> c) -> Either a b -> Either a b
foo f (Left a) = Left (f a)
foo f (Right b) = Right (f b)

foo' = foo (+ 2)