title: Efficiently find indices of maxima of a list
body: <p><strong>Edit</strong>: I must not have worded it clearly enough, but I'm looking for a function <em>like</em> the one below,  but not exactly it.  </p>
  
  <p>Given a list, I wanted to be able to find the index of the largest element in the list<br>
  (So, <code>list !! (indexOfMaximum list) == maximum list</code>)<br>
  I wrote some code that seems pretty efficient, although I feel I'm reinventing the wheel somewhere.  </p>
  
  <pre><code>indexOfMaximum :: (Ord n, Num n) =&gt; [n] -&gt; Int
  indexOfMaximum list =
     let indexOfMaximum' :: (Ord n, Num n) =&gt; [n] -&gt; Int -&gt; n -&gt; Int -&gt; Int
         indexOfMaximum' list' currIndex highestVal highestIndex
            | null list'                = highestIndex
            | (head list') &gt; highestVal = 
                 indexOfMaximum' (tail list') (1 + currIndex) (head list') currIndex
            | otherwise                 = 
                 indexOfMaximum' (tail list') (1 + currIndex) highestVal highestIndex
     in indexOfMaximum' list 0 0 0
  </code></pre>
  
  <p>Now I want to return a list of the indices of the largest n numbers in the list.   </p>
  
  <p>My only solution is to store the top n elements in a list and replace <code>(head list') &gt; highestVal</code> with a comparison across the n-largest-so-far list.  </p>
  
  <p>It feels like there has to be a more efficient way than to do this, and I also feel I'm making insufficient use of Prelude and Data.List. Any suggestions? </p>