|
|
|
|
|
by koomi
4727 days ago
|
|
There is no general zip for every Traversable, though there is one for every Applicative with a suitable instance (like the ZipList wrapper for lists): liftA2 (,) The reason is that you need to operate on multiple containers at once and that is what Applicative's (<*>) provides, while Traversable only requires Functor and can therefore only traverse one container at a time. So what Haskell has is just internal iteration, but we have another interface for internal iteration on multiple containers that allows zip to be implemented easily. |
|