3 ms·
I think it would be possible to create a generalised `zipN` function, using the Haskell printf trick[0], but it would be a lot of complication for little benefi
by aninhumer 10y ago
I think it would be possible to create a generalised `zipN` function, using the Haskell printf trick[0], but it would be a lot of complication for little benefit. It's rare that you need to merge that many streams at once, and adding a single digit is not a huge hassle in those cases. Also I'd probably consider splitting the operation up into stages if I was using anything higher than `zipWith3`.
[0]http://stackoverflow.com/questions/7828072/how-does-haskell-printf-work http://stackoverflow.com/questions/7828072/how-does-haskell-...
- drostie 10y agoYou also have an equivalent on a family of isomorphic types, namely the types forall z. (a -> b -> c -> ... -> z) -> ZipList z This is gotten by taking your `list_a :: [a]` etc. and writing: \f -> f <$> ZipList list_a <*> ZipList list_b <*> ZipList list_c <*> ... You can of course also use Haskell pair-stacks to do all of this, storing (a, b, c, ...) as the type (a, (b, (c, ... ())))...