{-# language ImpredicativeTypes #-} module M where class C m foo :: forall m. C m => Int -> m Char foo _ = undefined tgt :: Int -> forall m. C m => m Char tgt x = foo x hm :: Functor f => f Int -> f (forall m. C m => m Char) hm = fmap tgt hm2 :: Functor f => f Int -> f (forall m. C m => m Char) hm2 = fmap (\x -> foo x)