Hi all,

I have this code

myMaximumBy :: (a -> a -> Ordering) -> [a] -> a
myMaximumBy _ [] = undefined
myMaximumBy _ (x:[]) = x
myMaximumBy f (x:xs) =
  case f x maxRestOfList of
    GT -> x
    _ -> maxRestOfList
    where maxRestOfList = myMaximumBy f xs

whereby the case myMaximumBy _ [] will never happen because case myMaximumBy _ (x:[]) = x prevents that from happening. However i will still like to define it to keep -Wall warning from complaining. 

Is using undefined acceptable or is there a better way?

--
Best Regards,
Boon Hui