I have the following small function that uses foldr to find the largest second number of a 2-tuple:
listMax :: [(Int,Int)] -> Int listMax = snd . foldr (\(_,freq1) (_,freq2) -> (0,max freq1 freq2)) (0,0)
My question pertains to the body of the lambda:
(0,max freq1 freq2)
I had to make it into a tuple with a dummy head so that it matches it's own input for the fold. To me though, it looks ugly and makes it harder to read. Is this the standard way of dealing with this situation, or is there a idiomatic way around this?