
13 Aug
2007
13 Aug
'07
2:05 p.m.
On 8/11/07, Per Vognsen
Applicative functors can indeed help:
(,,,) <$> [1,2,3] <*> [-1,0,1] <*> [1,1,1] <*> [0,2,6]
You just use n-1 commas when you want the effect of zipn.
Actually, that's not quite right, since that uses the applicative functor related to the list monad (so you get a list of 4-tuples of all possible combinations, rather than a 4-way zip). To get the zip behavior, you need to add a ZipList constructor in front of all the lists, and then apply getZipList at the end to extract. -Brent