Proposal: Add gtraverse to Data.Data

Edward Kmett ekmett at
Fri Aug 16 01:21:39 CEST 2013

Data.Data provides an gmapM as an analogue to mapM but not one to traverse.

The following definition from lens fills in this gap, but it probably
belongs in Data.Data alongside its kin.

gtraverse :: (Applicative f, Data a) => (forall d. Data d => d -> f d)
-> a -> f a

gtraverse f = gfoldl (\x y -> x <*> f y) pure

Discussion period: 2 weeks

-Edward Kmett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list