title: Comparing list length with arrows
body: <p><em>Inspired by <a href="https://stackoverflow.com/questions/7730170/comparing-list-length">Comparing list length</a></em></p>
  
  <p>If I want to find the longest list in a list of lists, the simplest way is probably:</p>
  
  <pre><code>longestList :: [[a]] -&gt; [a]
  longestList = maximumBy (comparing length)
  </code></pre>
  
  <p>A more efficient way would be to precompute the lengths:</p>
  
  <pre><code>longest :: [[a]] -&gt; [a]
  longest xss = snd $ maximumBy (comparing fst) [(length xs, xs) | xs &lt;- xss]
  </code></pre>
  
  <p>Now, I want to take it one step further. It may not be more efficient for normal cases, but can you solve this <strong>using arrows</strong>? My idea is basically, step through all of the lists simultaneously, and keep stepping until you've overstepped the length of every list except the longest.</p>
  
  <pre><code>longest [[1],[1],[1..2^1000],[1],[1]]
  </code></pre>
  
  <p>In the forgoing (very contrived) example, you would only have to take two steps through each list in order to determine that the list <code>[1..2^1000]</code> is the longest, without ever needing to determine the entire length of said list. Am I right that this can be done with arrows? If so, then how? If not, then why not, and how could this approach be implemented?</p>