Generate generalized fmap, foldMap and traverse