
Sean Leather wrote:
EMGM [1] has a generic zipWith [2]:
zipWith :: FRep3 ZipWith f => (a -> b -> c) -> f a -> f b -> Maybe (f c)
This is generic according to the container type 'f'. A particular specialization of this is zip:
zip :: FRep3 ZipWith f => f a -> f b -> Maybe (f (a, b))
Also, module Data.Zippable of package http://hackage.haskell.org/cgi-bin/hackage-scripts/package/bff has: tryZip :: Zippable f => f a -> f b -> Either String (f (a,b)) where "Either String" plays the role of "Maybe" above. And for the underlying Zippable class, Joachim Breitner has implemented an automatic TH deriver (makeZippable) using the derive-package. So no manual boilerplate at all is necessary to use this version of generic zip. (And there is also a tryZipWith.) Ciao, Janis. -- Dr. Janis Voigtlaender http://wwwtcs.inf.tu-dresden.de/~voigt/ mailto:voigt@tcs.inf.tu-dresden.de