How to find the index of the maximum element? How about trying all indexes and checking whether they are the maximum?
ghci> let maxIndex xs = head $ filter ((== maximum xs) . (xs !!)) [0..]
But this sounds like something for which a function already exists. My code will be more readable, maintainable, and probably even more efficient, if I used the existing function.
So I should just ask SO how to do it, and in 15 minutes I'll get an answer and some snarky comments. Or - I could ask hoogle and get a useful response immidiately (as Will suggested)
$ hoogle "Ord a => [a] -> Int" | head
<Nothing relevant>
$ # hmm, so no function to give me the index of maximum outright,
$ # but how about finding a specific element, and I give it the maximum?
$ hoogle "a -> [a] -> Int" | head
Data.List elemIndex :: Eq a => a -> [a] -> Maybe Int
Data.List elemIndices :: Eq a => a -> [a] -> [Int]