What should a “higher order Traversable” class look like?
问题 In this answer I made up on the spot something which looks a bit like a "higher order Traversable ": like Traversable but for functors from the category of endofunctors on Hask to Hask. {-# LANGUAGE RankNTypes #-} import Data.Functor.Compose import Data.Functor.Identity class HFunctor t where hmap :: (forall x. f x -> g x) -> t f -> t g class HFunctor t => HTraversable t where htraverse :: Applicative g => (forall x. f x -> g x) -> t f -> g (t Identity) htraverse eta = hsequence . hmap eta