I know that the program can sort the list by Mfg or by Year(descending). That is defined on line 9 and 10. But what exactly is the code doing? What is (<>)?
import Data.Semigroup ((<>))
import Data.List (sort, sortOn)
import Data.Ord (comparing)
data Vehicle = Vehicle { mfg :: String, year :: Int } deriving (Eq, Show)
mycars =[Vehicle "Saab" 2000, Vehicle "Volvo" 1995]
instance Ord Vehicle where
compare = flip (comparing year) <> comparing mfg
main = do
print $ sortOn mfg mycars
print $ sort mycars