I’m looking for some attractive Haskell syntax for the following
I have a function that takes 4 argument.
f a b c d = Something
I’d like to supply a lists for each of the arguments and get back the a list of the results of each combination.
Essentially a nested map function.
I fell like there should be an elegant solution. But, I haven’t found anything that will compile.
Your question is not very clear: do you want all possible combinations (take any
afrom the first list, anybfrom the second etc.) or processing lists in parallel a.k.a. zip (the first element of each list, the second element and so on).Both can be nicely solved with applicative functors: