As I'm not familiar with rank-N types, the type signature of gfoldl is a troublesome for me:
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> a
-> c a
The only functions I can think of are \xs y -> ($y) <$> xs and pure, respectively.
Other functions such as gunfold and gmapT have similar problems. So what are notable examples of nontrivial uses of them?
For the
gmapTcase themkTfunction is defined for this purpose in the original paper.For example to increment all
intfields in theA, you can write something likeTo make it clearer the
exfunction can be written like this too: