title: Combining two list comprehensions Haskell
body: <p>I'm trying to calculate the first triangle number with 501 divisorsin Haskell. I already made two list comprehensions, one listing all the triangle numbers and one listing all divisors of a given number. Now I want to make one big list with all values divisors of each triangle number.
  (e.g. [[1],[1,3],[1,2,3,6],[1,2,5,10] etc..)</p>
  
  <p>How can I use my triangleNumbers list in my divisors list?
  My code is below.</p>
  
  <pre><code>triangleNumbers = [t | a &lt;- [0..], let t = a*(a+1)/2] 
  divisors triangleNumbers = [d | d &lt;- [1..triangleNumbers], triangleNumbers 
  `mod` d == 0]
  numDivisors = takeWhile(&lt;501) length . divisors
  answer = divisors !! numDivisors
  </code></pre>