Suppose I have two functions f :: [a] -> b and g :: [a] -> c. I have the following two questions:
If I perform
(f &&& g) xswherexs :: [a], and if bothfandginvolve loops, is it possible for the compiler to optimize these two loops into one? (Please note that I am not asking whether some specific Haskell compiler implements this. I want to know whether such a thing is possible.)Can the
traversefunction fromTraversetype class help me have such an optimization with something along the following lines:traverse (someCombinator f g) xs