title: Haskell: List Comprehension / Hash Table Entries
body: <p>I'm trying to place a bunch of words into a hash table based on length.  The words are stored in</p>
  
  <pre><code>data Entry = Entry {word :: String, length :: Int} deriving Show
  </code></pre>
  
  <p>Now, I've got all the words stored in "entries", which is a list of Entry.  Then, my hash table is defined as follows:</p>
  
  <pre><code>type Hash = [Run]
  type Run = [Entry]
  </code></pre>
  
  <p>Now I'm trying to figure out how to get the entries into the hash table.  The following is my current attempt</p>
  
  <pre><code>maxL = maximum [length e | e &lt;- entries]
  runs = [r | r &lt;- [e | e &lt;- entries, length e == i]] where i = [1..maxL]
  </code></pre>
  
  <p>Compiler's obviously telling me that Int can't be compared to [Int], but I don't know how to say</p>
  
  <pre><code>e | e &lt;- entries, e has length i
  </code></pre>
  
  <p>Any help is much appreciated! </p>
  
  <p>Cheers</p>