title: Using functions inside list comprehensions, Haskell?
body: <p>Can we put functions to determine the condition for our list comprehensions.  Here is my code that I am trying to implement:</p>
  
  <pre><code>mQsort :: [String] -&gt; [F.Record] -&gt; [F.Record]
  mQsort [] _ = []
  mQsort c@(col:cond:cs) l@(x:xs) = (mQsort c small) ++ mid ++ (mQsort c large)
     where
      small = [y | y&lt;-xs, (qGetStr col y) (qGetCond cond) (qGetStr col x)]
      mid   = mQsort cs [y | y&lt;-l, (qGetStr col y) == (qGetStr col x)]
      large = [y | y&lt;-xs, (qGetStr col y) (qGetCond' cond) (qGetStr col x)]
  
  qGetStr :: String -&gt; F.Record -&gt; String
  qGetStr col r | U.isClub col = F.club r
              | U.isMap col = F.mapName r
              | U.isTown col = F.nearestTown r
              | U.isTerrain col = F.terrain r
              | U.isGrade col =F.mapGrade r
              | U.isSW col = F.gridRefOfSWCorner r
              | U.isNE col = F.gridRefOfNECorner r
              | U.isCompleted col = F.expectedCompletionDate r
              | U.isSize col = F.sizeSqKm r
              | otherwise = ""
  
  qGetCond "ascending" = (&lt;)
  qGetCond "decending" = (&gt;)
  qGetCond' "ascending" = (&gt;)
  qGetCond' "decending" = (&lt;)
  </code></pre>
  
  <p>I get an error stating that the function qGetStr is applied to 4 arguments instead of 2.<br>
  Also, qGetCond - is this the right syntax to return an operator.  I had to place the operator in brackets due to a compile error, but I have a feeling this is incorrect</p>