Even after I imported the Data.List package, I still get "Not in scope: sortOn" error message. I am using HaskellPlatform 2014.2.0 version.
this Error message is there because sortOn
has been introduced in base-4.8
(see hackage-base
but haskell-platform 2014.2.0 only includes base-4.7.0.1 (see haskell-platform-doc)
but you can easily build it on your own with sortBy
(see @vikingsteve's answer) compare
and on
(you need to import Data.List
for that)