I am relatively new to Haskell, so hopefully this is not a dumb question. I'm looking for a common / well known type that essentially acts a tuple, but has Ord defined such that it only compares by the first element.
I can define this myself as such:
data RankedItem a = RankedItem Double a deriving (Show)
instance Eq (RankedItem a) where
(RankedItem lkey _) == (RankedItem rkey _) = lkey == rkey
instance Ord (RankedItem a) where
(RankedItem lkey _) `compare` (RankedItem rkey _) = compare lkey rkey
Is there a built in type or a commonly used third party container that achieves this?