You can use maximumBy
with comparing
:
module Main where
import Data.Ord (comparing)
import Data.List (maximumBy)
findMaxVal :: (Num a, Ord a, Num b, Ord b) => [((a, b), (a, b), (a, b))] -> b
findMaxVal = xWidth . maximumBy (comparing tWidth)
where
xWidth ((_, x1), (_, x2), _) = x2 - x1
tWidth ((t1, _), _, (t3, _)) = t3 - t1
Travis Brown
2010-08-11 21:02:29