data Cartesian2D = Cartesian2D { xCoord :: Double, yCoord :: Double } deriving (Eq, Show) lowestCoord :: [Cartesian2D] -> Cartesian2D lowestCoord xs = minimumBy f xs where f a b = case (compare `on` yCoord) a b of EQ -> (compare `on` xCoord) a b x -> x