title: Creating a new list that adds and sums elements from an old list
body: <p>I have a list <code>xxs</code> and I need to create a new one that adds and sums elements from the old list. </p>
  
  <p>Let me draw it to demonstrate:</p>
  
  <p><img src="https://i.stack.imgur.com/0FPIj.png" alt="visualization of list transformation"></p>
  
  <p>So, I have the list:</p>
  
  <pre><code>xxs = [("a","b", [(1,"a","b"),(2,"a","b")]), ("c","d",[(3,"a","b"),(4,"a","b")])]
  </code></pre>
  
  <p>My best approach so far is:</p>
  
  <pre><code>infoBasicas = [ (x,y,aux) | (x,y,_) &lt;- xxs]
      where aux = sum [ z | (_,_,ys) &lt;- xxs, (z,_,_) &lt;- ys] 
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[("a","b",10),("c","d",10)]
  </code></pre>
  
  <p>Although I’m not far away… I'm not quite there yet and would really appreciate some suggestions.</p>