A very basic Top-N algorithm in Haskell