Question about typing
09 Apr 2001 14:33:47 +0200
Matt Harden <firstname.lastname@example.org> writes:
> zip :: ZipFunctor f => f a -> f b -> f (a,b)
> zip = zipWith (,)
> zip3 :: ZipFunctor f => f a -> f b -> f c -> f (a,b,c)
> zip3 = zipWith3 (,,)
> One can easily create ZipFunctor instances for trees and other data
> structures. I can provide examples if you like. With multiple
> parameter type classes (MPTCs, they are not in Haskell 98) as well as
> functional dependencies (also not in h98), one can also create a
> "Zippable" class to generalize the zip function over multiple tuple
> types and eliminate zip3, zip4, etc.
can you explain how you do that ?? (i dont know what is
functional dependencies, but i think i understand multiple parameter type classes
and i dont see how do make something that avoid to define a zip3 zip4 ....